home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #15 / Monster Media Number 15 (Monster Media)(July 1996).ISO / pcboard / cbfree13.zip / CB.PPS < prev    next >
Text File  |  1996-06-08  |  107KB  |  3,415 lines

  1. ;┌───────────────────────────────────────────────────────────────────────────┐
  2. ;│ CB.PPE - Written by Dan Shore - SysOp                                     │
  3. ;│                     The Shoreline BBS                                     │
  4. ;│                     June, 8, 1996                                         │
  5. ;│                                                                           │
  6. ;│ Purpose:  A PPE Callback program for upgrading users                      │
  7. ;│                                                                           │
  8. ;│ Do not erase this top part of the source code.                            │
  9. ;├───────────────────────────────────────────────────────────────────────────┤
  10. ;│ If you make changes to this source code, add your name to the list and    │
  11. ;│ the dates of the changes and a quick note of the changes made.            │
  12. ;│┌───────────────┬──────────────┬──────────────────────────────────────────┐│
  13. ;││Name           │    Date      │          Modifications                   ││
  14. ;│└───────────────┴──────────────┴──────────────────────────────────────────┘│
  15. ;│                                                                           │
  16. ;│                                                                           │
  17. ;└───────────────────────────────────────────────────────────────────────────┘
  18. ;
  19. ;  In this program there are no functions or procedures, as subroutines
  20. ;  are used throughout this program.  If you want functions and procedures
  21. ;  or find they will work out better, you have the code at your disposal.
  22. ;
  23. ;  I do not boast about my code, but what I write works, plus I have
  24. ;  EXTENSIVE comments all throughout the code.  This should help you
  25. ;  follow what is occuring at each place in the program.
  26. ;
  27. ;  If you find a better way to do something in this program or add a new
  28. ;  feature, share this with the author and others that use the program.
  29. ;  Posting of changes should be at Salt Air and the author's BBS (FREQ
  30. ;  the file to the author)
  31. ;
  32. ;  It is the input of yourself and others that will make this PPE the
  33. ;  best CBV for PCBoard SysOps everywhere.
  34. ;
  35. ;
  36. ; To install in PCBoard:
  37. ; ──────────────────────
  38. ;
  39. ; A. Edit your CMD.LST file(s) to add this:
  40. ;
  41. ;                           Charges Per     PPE/MNU File Specification -or-
  42. ;          Command    Sec  Minute    Use    Keystroke Substitution
  43. ;      ══════════════ ═══ ═════════════════ ═════════════════════════════════
  44. ;   1) CALLBACK         3        0        0 C:\PCB\PPE\CALLBACK\CB.PPE
  45. ;
  46. ;           Note: You may have to change the pathname to the PPE.
  47. ;           Note: You may have to change the security level
  48. ;
  49. ;      Note: Another way for the callback to be invoked is have
  50. ;            the PPE run via an entry in the security specific display
  51. ;            files.  In this display file all you will need is an
  52. ;            entry that looks like the following:
  53. ;
  54. ;            !C:\PCB\PPE\CALLBACK\CB.PPE
  55. ;
  56. ;            When the security specific file is displayed the
  57. ;            callback program will be invoked.  With this method
  58. ;            the user is FORCED to use the Callback program.  Where
  59. ;            when it is in the CMD.LST file, the user can execute
  60. ;            the callback after looking around your BBS first.
  61. ;
  62. ;
  63. ; To setup the PPE:
  64. ; ─────────────────
  65. ;
  66. ;  A.  Edit the CBCFG.SAM file to match your BBS requirements
  67. ;      and save your changes to the filename CB.CFG or to a
  68. ;      node specific configuration file - CBx.CFG.  (x = node #)
  69. ;        ** Remember there are 26 configuration options **
  70. ;
  71. ;  B.  Edit the LC-SL.CFG file (Local Call Security File).
  72. ;        ** One entry for every security level that will use CB.PPE **
  73. ;
  74. ;  C.  Edit the LD-SL.CFG file (Long Distance Security File).
  75. ;        ** One entry for every security level that will use CB.PPE **
  76. ;
  77. ;  D.  Edit the BAD-NAME.LST file to include any username(s) you wish to
  78. ;      be banned from using the callback program.
  79. ;
  80. ;  E.  Edit the BAD-NUM.LST file to include any phone numbers you wish
  81. ;      to be banned from using the callback program.
  82. ;
  83. ;  F.  Edit the TRASHCAN.SAM file for blocking areacodes, exhanges or
  84. ;      the last four numbers from being used in a callback.  Rename
  85. ;      this file to TRASHCAN.DAT
  86. ;
  87. ;  G.  OPTIONAL:  If you have configuration line #13 set for TRUE, then
  88. ;                 you MUST use the AREACODE.DAT file to check for valid
  89. ;                 areacodes for callback.
  90. ;
  91. ;  H.  OPTIONAL:  If you have configuation line #14 set for TRUE, then
  92. ;                 you must create a xxxXCHNG.DAT file for EVERY areacode
  93. ;                 that can be a local call to you. (xxx = areacode)
  94. ;                 The format of the file is one EXCHANGE per line.
  95. ;
  96. '════════════════════════════════════════════════════════════════════════════
  97. STRING hold                         ' Generic string variable
  98. STRING hold2                        ' Generic string variable
  99. STRING log_entry                    ' holds information for log file
  100. STRING init_string                  ' Modem intialization string
  101. STRING phone_number                 ' Phone number to call
  102. STRING h_phone_number               ' Voice Phone number from User record
  103. STRING d_phone_number               ' Data Phone number from User record
  104. STRING area_code                    ' Area code user entered
  105. STRING exchange                     ' Exchange user entered
  106. STRING last_4_nums                  ' Last 4 numbers user entered
  107. STRING password_input               ' Password user inputs
  108. STRING user_input                   ' Generic input variable
  109. STRING main_prompt                  ' Generic prompt variable
  110. STRING modem_string                 ' Variable to hold strings from modem
  111. STRING send_modem                   ' Variable to send strings to modem
  112. STRING area_code_local              ' Area Codes that are always a local call
  113. STRING local_no_area_code           ' Area code that is local
  114. STRING msg_text_file                ' Path and filename of msg to import upon
  115.                                     '   successful callback
  116. STRING verification_type            ' Type of verfication (USER, PASS, or BOTH)
  117. STRING username_input               ' Username input for verification
  118. STRING caller_id_info               ' Caller ID telephone information
  119. STRING dialing_string               ' String to initiate dialing by modem
  120.                                     '   ATDT for Touch Tone Dialing
  121.                                     '   ATDP for Dial Pulse Dialing
  122. STRING dialing_prefix               ' Prefix number added to phone number.
  123.                                     '   This is *usually* a number to gain
  124.                                     '   access to an outside line.
  125. STRING dialing_suffix               ' Suffix number added to phone number.
  126.                                     '   This is *usually* a number to gain
  127.                                     '   access to an outside line.
  128. STRING suffix_use                   ' When to use Suffix number
  129. STRING ld_prefix                    ' Number to add to the beginning of a LD
  130.                                     '   callback for NON-INTERNATIONAL.
  131.                                     '   An entry of "1" would add a 1 to
  132.                                     '   the beginning of the phone number
  133. STRING intl_ld_prefix               ' Number to add to the beginning of a LD
  134.                                     '   callback for an INTERNATIONAL callback.
  135.                                     '   An entry of "011" would add a 011 to
  136.                                     '   the eginning of the phone number
  137. STRING post_cbinfo_user_record      ' String which determines if we post callback
  138.                                     '   information to COMMENT or NOTES in user
  139.                                     '   record
  140. STRING country_code                 ' Country Code  - INTL only
  141. STRING exchange_code                    ' City Code     - INTL only
  142. STRING last_nums                    ' Last numbers  - INTL only
  143. STRING cid_string_to_search         ' String to search in CID info to find
  144.                                     '   the telephone number
  145. STRING add_ac_to_cid                ' Areacode to add to beginning of phone
  146.                                     '   number when CID only returns 7 digits
  147.                                     '   (exchange & last 4)
  148. STRING blocked_cid_string           ' If checking for CID blocking, this is
  149.                                     '   the string to search for.  Examples
  150.                                     '   of string are PRIVATE, BLOCKED, etc.
  151.  
  152. INT us_min_phone_number_length      ' Minimum length of callback phone number
  153.                                     '   for US calling plan
  154. INT intl_min_phone_number_length    ' Minimum length of callback phone number
  155.                                     '   for INTL calling plan
  156. INT expired_date_days               ' Days to ADD to current expired security
  157.                                     '   date (0 = 00/00/00 expired date)
  158. INT expired_level                   ' Expired Security level for successful
  159.                                     '   callback
  160. INT verified_level                  ' Security level of verified user
  161. INT failure_level                   ' Security level of user for failed callback
  162. INT highest_sec_level_allowed       ' Highest security allowed to use door
  163. INT verification_entry_count        ' How many times can password be tried
  164. INT trash_type                      ' When checking trash can, which field
  165. INT modem_byte                      ' Modem output read into this variable
  166.                                     '   from MGETBYTE
  167. INT duration_to_call                ' timeout value
  168. INT local_time_to_call              ' Local timeout
  169. INT ld_time_to_call                 ' LD timeout
  170. INT int_count                       ' Miscellaneous INT variable
  171. INT count                           ' Miscellaneous INT variable
  172. INT current_timeout_value           ' Show how many seconds have elapsed for
  173.                                     '   callback
  174. INT adjust_mins                     ' Time to add or subtract from users
  175.                                     ' current online time
  176. INT ck_length                       ' Check length of input
  177. INT inp_length                      ' Allowed length of input
  178. INT cp_required                     ' Calling plan required by caller
  179. INT start_read                      ' When to start reading a string
  180.  
  181. INTEGER start_time                  ' Timer for starting time
  182. INTEGER end_time                    ' Timer for ending time
  183.  
  184. UNSIGNED msg_conf_num               ' Conference number to import success
  185.                                     '   message
  186.  
  187. FLOAT cb_remain_number              ' Number call back times remaining
  188. FLOAT busy_value                    ' Value to deduct from total times to
  189.                                     '   callback user when a BUSY is encountered
  190. FLOAT no_dial_value                 ' Value to deduct from total times to
  191.                                     ' callback user when a NO DIAL (no dialtone)
  192.                                     '   is encountered
  193. FLOAT ring_value                    ' Value to deduct from total times to
  194.                                     '   callback user when a RING (incoming call)
  195.                                     '   is encountered
  196.  
  197. REAL temp_real                      ' Generic REAL variable
  198.  
  199. TIME local_start_time               ' Start time to allow local callbacks
  200. TIME local_end_time                 ' End time to allow local callbacks
  201. TIME ld_start_time                  ' Start time to allow LD callbacks
  202. TIME ld_end_time                    ' End time to allow LD callbacks
  203.  
  204. BOOLEAN made_connection             ' Flag for made callback connection
  205. BOOLEAN found1                      ' Flag when searching area code/exchange
  206.                                     '   files
  207. BOOLEAN local_call                  ' Local or LD Call Flag
  208. BOOLEAN already_verified            ' User has been verified before
  209. BOOLEAN no_call                     ' Callback is outside allowed time if true
  210.                                     ' and no callback will be made
  211. BOOLEAN user_record_phone           ' Flag file to indicate if user used
  212.                                     ' phone number from user record info
  213. BOOLEAN do_increase                 ' Flag to determine if user gets security
  214.                                     '   level increase
  215. BOOLEAN sysop_recycle               ' Flag for when SysOp hits space bar to
  216.                                     '   recycle callback
  217. BOOLEAN password_correct            ' Flag for when password verification is
  218.                                     '   correct
  219. BOOLEAN username_correct            ' Flag for when username verification is
  220.                                     '   correct
  221. BOOLEAN use_other                   ' Flag to display "Use Other Phone Number"
  222. BOOLEAN ck_area_code                ' Flag to use AREACODE.DAT file to check for
  223.                                     '   allowed area codes
  224. BOOLEAN ck_exchange                 ' Flag to look for xxxXCHNG.DAT file for
  225.                                     '   determining LOCAL CALLS
  226. BOOLEAN up_already_verified         ' Flag to upgrade a previously verified user
  227. BOOLEAN process_caller_id           ' Flag to turn on CALLER ID processing
  228. BOOLEAN use_caller_id_info          ' Flag to use caller ID information
  229. BOOLEAN upgrade_caller_id           ' Flag to upgrade user if caller ID matches
  230.                                     '   phone number(s) from user record
  231. BOOLEAN us_call_plan                ' Flag to indicate US calling plan type
  232. BOOLEAN intl_call_plan              ' Flag to indicate INTL calling plan type
  233. BOOLEAN intl_callback               ' True if callback is international
  234. BOOLEAN cid_matches_user            ' Flag for CID matching user record phone #
  235. BOOLEAN drop_ld_cb                  ' Flag to hangup (TRUE) after a LD Callback
  236. BOOLEAN prompt_for_zero             ' Flag to prompt the user to add a "0" to #
  237. BOOLEAN cid_use_hex                 ' Phone number is in HEX and not ASCII
  238. BOOLEAN improper_user_rec_phone     ' Flag for user record phone number chosen
  239.                                     '   in proper format
  240. BOOLEAN block_ld_callbacks          ' Flag to block ALL Long Disntance callbacks
  241. BOOLEAN stop_blocked_cid_caller     ' Flag to stop callback if user is blocking
  242.                                     ' CID information (will appear as PRIVATE)
  243. '
  244. '═════════════════════════════════════════════════════════════════════════════
  245. '
  246. :MAIN
  247.  
  248.    '
  249.    '  Write to PCB Callers File that user entered Callback
  250.    '
  251.    LOG "*** User Entered Callback Program ***", FALSE
  252.  
  253.    '
  254.    '  Callback is ALWAYS local unless overriden (User entered a LD #)
  255.    '
  256.    local_call = TRUE
  257.  
  258.    '
  259.    '  Open our NODE Specific Log file in append mode
  260.    '
  261.    FAPPEND 7, PPEPATH()+"NODE" + STRING(PCBNODE()) + ".LOG", O_WR, S_DW
  262.    FPUTLN 7, ""
  263.    FPUTLN 7, "*********** Starting up CallBack ************"
  264.  
  265.    '
  266.    '  Read the programs configuration file (CB?.CFG -or- CB.CFG)
  267.    '
  268.    GOSUB READ_CFG
  269.  
  270.    '
  271.    '  Get current user info and log it
  272.    '
  273.    GETUSER
  274.    FPUTLN 7, "Callback started for user: ", U_NAME()
  275.    FPUTLN 7, "                     Date: ", DATE()
  276.    FPUTLN 7, "                     Time: ", TIME()
  277.    FPUTLN 7, "    User's Security Level: ", U_SEC
  278.    FPUTLN 7, "   User's Expiration Date: ", U_EXPDATE
  279.    FPUT 7, "       Verification Using: "
  280.  
  281.    IF (verification_type = "BOTH") THEN FPUTLN 7, "Username & Password Check"
  282.    ELSE IF (verification_type = "USER") THEN FPUTLN 7, "Username Check"
  283.    ELSE IF (verification_type = "PASS") THEN FPUTLN 7, "Password Check"
  284.    END IF
  285.  
  286.    '
  287.    '  Check to see if their security level is too high to use the program
  288.    '
  289.    GOSUB SECURITY_CHECK
  290.  
  291.    '
  292.    '  Check to see if the username is in the BAD-NAME.LST file
  293.    '
  294.    GOSUB BAD_NAMES
  295.  
  296.    '
  297.    '  Clear the screen and welcome the user to the Callback Program
  298.    '
  299.    CLS
  300.    DISPFILE PPEPATH() + "WELCOME", GRAPH+LANG
  301.  
  302.    '
  303.    '  Prompt user to C)ontinue callback or E)xit back to BBS
  304.    '
  305.    main_prompt = "          @X0EC@X0F)@X02ontinue Callback process, @X0EE@X0F)@X02xit Callback@X0F"
  306.    user_input = "C"
  307.    INPUTSTR main_prompt, user_input, @X0F, 1,"CE", FIELDLEN+GUIDE+LFAFTER+UPCASE
  308.  
  309.    '
  310.    '  See if user choose to exit the PPE
  311.    '
  312.    IF (user_input = "E") THEN
  313.      FPUTLN 7, "**-->> User aborted callback"
  314.      local_call = TRUE
  315.      GOTO EXIT_PROG
  316.    END IF
  317.  
  318.    '
  319.    '  US and INTL (BOTH) enabled, ask user which format to use
  320.    '
  321.    IF (us_call_plan && intl_call_plan) THEN
  322.  
  323.      '
  324.      '  Display file so user can choose callback phone format
  325.      '
  326.      '  Default = US Format (ac/ex/4)
  327.      '
  328.      DISPFILE PPEPATH() + "PFORM1", GRAPH+LANG+SEC
  329.      user_input = "1"
  330.      NEWLINE
  331.      main_prompt = "           @X0EPlease make your selection"
  332.      INPUTSTR main_prompt, user_input, @X0F, 1, "12", FIELDLEN+GUIDE+LFAFTER
  333.  
  334.      '
  335.      '  See what the user selected
  336.      '
  337.      IF (user_input = "1") THEN
  338.        cp_required = 1
  339.        FPUTLN 7, "  Calling format selected: US"
  340.      ELSE
  341.        cp_required = 2
  342.        FPUTLN 7, "  Calling format selected: INTL"
  343.      END IF
  344.  
  345.      '
  346.      '  Display file so user can tell us if International Callback or not
  347.      '
  348.      '  Default = Non-International Callback (Local or Long Distance)
  349.      '
  350.      DISPFILE PPEPATH() + "PFORM2", GRAPH+LANG+SEC
  351.      user_input = "1"
  352.      NEWLINE
  353.      main_prompt = "           @X0EPlease make your selection"
  354.      INPUTSTR main_prompt, user_input, @X0F, 1, "12", FIELDLEN+GUIDE+LFAFTER
  355.  
  356.      '
  357.      '  Get users response
  358.      '
  359.      IF (user_input = 2) THEN
  360.        FPUTLN 7, "       International Call: TRUE"
  361.        intl_callback = TRUE
  362.      ELSE
  363.        FPUTLN 7, "       International Call: FALSE"
  364.      END IF
  365.  
  366.    '
  367.    '  Only use US call plan (ac/ex/4)
  368.    '
  369.    ELSE IF (us_call_plan) THEN
  370.      cp_required = 1
  371.  
  372.    '
  373.    '  Only use INTL call plan (cc/cc/last)
  374.    '
  375.    ELSE IF (intl_call_plan) THEN
  376.      cp_required = 2
  377.    END IF
  378.  
  379.    '
  380.    '  We will now get the users phone number they want to use
  381.    '  for callback.  If CID is used, we will use that number
  382.    '  and not prompt the user for a phone number.
  383.    '
  384.    GOSUB BEGIN_CALLBACK
  385.  
  386.    '
  387.    '  Check the BAD_NUM.LST file for a matching phone number
  388.    '
  389.    IF (EXIST(PPEPATH() + "BAD-NUM.LST")) GOSUB CHECK_BAD_NUMBER
  390.  
  391.    '
  392.    '  See if the callback will be local or LD and
  393.    '  check the times allowed to call
  394.    '
  395.    GOSUB CK_ALLOWED_TIMES
  396.  
  397.    '
  398.    '  Open the proper security file for local or long distance callers
  399.    '
  400.    GOSUB READ_SECURITY_FILE
  401.  
  402.    '
  403.    '  Set variable to false for use later on in the program
  404.    '
  405.    found1 = FALSE
  406.  
  407.    '
  408.    '  Search VERIFIED.LOG for verified phone numbers
  409.    '
  410.    GOSUB CK_VERIFIED_LOG
  411.  
  412.    '
  413.    '  Check Flag file (do_increase) for TRUE
  414.    '  If TRUE (User has been verified before..Do not re-verify)
  415.    '
  416.    IF (do_increase) THEN
  417.      GOSUB INCREASE_LEVEL
  418.      GOTO EXIT_PROG
  419.    END IF
  420.  
  421.    '
  422.    '  IF processing CALLER ID and caller ID information is not
  423.    '  blank -  Check to see if number matches phone numbers
  424.    '  from user record.
  425.    '
  426.    IF (process_caller_id && caller_id_info != "") THEN
  427.  
  428.      '
  429.      '  If configuration is set to automatically upgrade the
  430.      '  user if the caller ID matches user record phone number(s)
  431.      '  then process the following code.
  432.      '
  433.      IF (upgrade_caller_id) THEN
  434.  
  435.        '
  436.        '  Write CID to log file
  437.        '
  438.        FPUT 7, "  Caller ID = User Record: "
  439.  
  440.        '
  441.        '  See if we match the user record phone number with Caller ID.
  442.        '  If so, and the sysop has set upgrades to be done when the caller
  443.        '  ID matches a user record phone number, upgrade the user and exit
  444.        '  the callback program
  445.        '
  446.        IF (caller_id_info = h_phone_number || caller_id_info = d_phone_number) THEN
  447.          '
  448.          ' Set flag to true for matching user record with CID
  449.          ' and write to log file
  450.          '
  451.          cid_matches_user = TRUE
  452.          FPUTLN 7, "PHONE NUMBER MATCHES USER RECORD"
  453.  
  454.          '
  455.          '  Set variables to equal verification information
  456.          '
  457.          password_input = U_PWD
  458.          username_input = U_NAME()
  459.  
  460.          '
  461.          '  Set variable so security level increase is done
  462.          '
  463.          do_increase = TRUE
  464.          '
  465.          '  set flag to local call so user does not get
  466.          '  disconnected when CID matches user record
  467.          '  and it is a long distance phone call
  468.          '
  469.          local_call = TRUE
  470.  
  471.          '
  472.          '  Increase their security level for a successful callback
  473.          '
  474.          GOSUB INCREASE_LEVEL
  475.  
  476.          '
  477.          '  Time to say byby....
  478.          '
  479.          GOTO EXIT_PROG
  480.          '
  481.        ELSE
  482.  
  483.          '
  484.          '  Caller ID number DOES NOT match number(s) in User Record.
  485.          '  Callback will be done using the CALLER ID phone Number,
  486.          '
  487.          '  Log this information in the callback log file and the
  488.          '  callers log
  489.          '
  490.          FPUTLN 7, "FALSE"
  491.          FPUTLN 7, "**-->> Caller ID did NOT match User Record entries"
  492.  
  493.          FPUTLN 7, "    User's Security Level: ", U_SEC
  494.          LOG "**-->> Caller ID did NOT match User Record entries", FALSE
  495.          '
  496.        END IF
  497.      END IF          ' upgrade_caller_id
  498.    END IF            ' process _caller_id
  499.  
  500.    '
  501.    '    Ok, we are ready to call out now
  502.    '    Show the user instructions on how to answer phone
  503.    '
  504.    CLS
  505.    DISPFILE PPEPATH() + "INST", GRAPH+LANG+SEC
  506.  
  507.    '
  508.    '    Ask the user to continue or exit back to BBS - Last Chance!
  509.    '
  510.    hold = "P"
  511.    main_prompt = "@X0EP@X0F)@X02roceed with callback, or @X0EE@X0F)@X02xit back to BBS"
  512.    INPUTSTR main_prompt, hold, @X0F, 1, "EP", FIELDLEN+GUIDE+LFAFTER+UPCASE
  513.  
  514.    '
  515.    '  Check users response
  516.    '
  517.    IF (hold != "P") THEN
  518.      FPUTLN 7, "**-->> User aborted callback"
  519.      local_call = TRUE
  520.      GOTO EXIT_PROG
  521.    END IF
  522.  
  523.    '
  524.    '  Remind user how to answer incoming call before disconnecting
  525.    '
  526.    CLS
  527.    PRINTLN "@X0ARemember, type @X0A@X0FATA @X0Athen hit the @X0FENTER @X0Akey after your phone rings@X0F....@X07"
  528.    PRINTLN
  529.  
  530.    '
  531.    '  Set timeout duration from configuration file according to
  532.    '  local or LD call and build number for modem to dial
  533.    '
  534.    GOSUB SET_DURATION_BUILD_MODEM_DIAL
  535.  
  536.    '
  537.    '  IF not on local, write LOG file, and make phone call
  538.    '
  539.    IF (!ONLOCAL()) THEN
  540.      '
  541.      '  Close log file and reopen to commit prior logged information to disk
  542.      '
  543.      FCLOSE 7
  544.      FAPPEND 7,PPEPATH()+"NODE" + STRING(PCBNODE()) + ".LOG",O_WR,S_DW
  545.  
  546.      '
  547.      '  Perform callback - Continue till timeout or connect
  548.      '
  549.      GOSUB PERFORM_CALL
  550.      '
  551.    ELSE
  552.      '
  553.      '  Log we are in LOCAL mode, but show what modem
  554.      '  dial string would have been
  555.      '
  556.      FPUTLN 7, " Local Test-Modem Command: ", send_modem
  557.      '
  558.    END IF
  559.  
  560.    '
  561.    ' Got a connect from user, or this is a LOCAL user.
  562.    ' Time to get their password for verification
  563.    '
  564.    IF (made_connection || ONLOCAL()) THEN
  565.  
  566.       '
  567.       '  IF not on local, write to log, turn on CD and KBD Checking
  568.       '
  569.       IF (!ONLOCAL()) THEN
  570.         FPUTLN 7, "            Modem results: We are CONNECTED!!!..."
  571.         COLOR @X0E
  572.         ANSIPOS 2,18
  573.         SPRINT "Waiting for line to settle down..."
  574.         ANSIPOS 2,18
  575.         COLOR @X07
  576.         DELAY 54
  577.         CDCHKON
  578.         KBDCHKON
  579.       ELSE
  580.         NEWLINE
  581.         PRINTLN "   @X0F*** @X0CThis is a Local Logon Callback @X0F- @X0ENo Phone call made @X0F***@X07"
  582.         NEWLINE
  583.         DELAY 36
  584.       END IF
  585.  
  586.       '
  587.       '  Ask the user for their Password and verify it
  588.       '
  589.       GOSUB ASK_VERIFY_VERIFICATION_INFO
  590.  
  591.       '
  592.       '  User *has* entered correct password, or else they would not have
  593.       '  gotten to this part of the code, so tell'm whats up by displaying
  594.       '  the verification file.
  595.       '
  596.       '  Add their phone number to verified file, raise their security
  597.       '  level and add days (set in .CFG file) to their date of expiration
  598.       '
  599.       GOSUB INCREASE_LEVEL
  600.       '
  601.    ELSE
  602.      '
  603.      '  Too many tries attempted to call user for callback
  604.      '
  605.      FPUTLN 7, "**-->> Too many tries exceeded to make callback"
  606.  
  607.      '
  608.      '  Update users security to "FAILED" security level
  609.      '
  610.      U_SEC = failure_level
  611.      FPUTLN 7, "    Security Level set to: " + STRING(failure_level)
  612.      PUTUSER
  613.  
  614.      '
  615.      '  Clear the screen of the "CALLB" display
  616.      '
  617.      CLS
  618.      '
  619.    END IF
  620.  
  621.    '
  622.    '  Time to exit the PPE
  623.    '
  624.    GOTO EXIT_PROG
  625.  
  626. :END_MAIN
  627.  
  628. '┌─────────────────────────────────────────────────────────────────────────┐
  629. '│                                                                         │
  630. '│                 START OF SUBROUTINES USED IN CB.PPE                     │
  631. '│                                                                         │
  632. '└─────────────────────────────────────────────────────────────────────────┘
  633.  
  634. '
  635. '  Add voice number from User Record to VERIFIED.LOG
  636. '
  637. :ADD_VOICE_TO_LOG
  638.  
  639.     '
  640.     '  Add Voice phone number to Verified.Log
  641.     '
  642.     '  Entry that begins with an "*" is International
  643.     '
  644.     IF (cp_required = 1) THEN
  645.       h_phone_number = MID(h_phone_number, 1, 3) + "-" + MID(h_phone_number, 4, 3) + "-" +MID(h_phone_number, 7, 4)
  646.     ELSE IF (cp_required = 2) THEN
  647.       hold = "*" + MID(h_phone_number, 1, LEN(country_code)) + "-"  \
  648.                  + MID(h_phone_number, LEN(country_code)+1, LEN(exchange_code)) + "-" \
  649.                  + MID(h_phone_number, LEN(country_code) + LEN(exchange_code) + 1, LEN(h_phone_number) - LEN(country_code) + LEN(exchange_code))
  650.       hold = TRIM(hold, " ")
  651.       h_phone_number = hold + SPACE(24-LEN(hold))
  652.     END IF
  653.  
  654.     hold = h_phone_number + " " + U_NAME() + " " + STRING(TIME()) + " " + STRING(DATE()) + " " + "H/V from User Record"
  655.     FPUTLN 1, hold
  656.     RETURN
  657.  
  658. '
  659. '  Add data number from User Record to VERIFIED.LOG
  660. '
  661. :ADD_DATA_TO_LOG
  662.  
  663.     '
  664.     '  Add Data phone number to Verified.Log
  665.     '
  666.     '  Entry that begins with an "*" is International
  667.     '
  668.     IF (cp_required = 1) THEN
  669.       d_phone_number = MID(d_phone_number, 1, 3) + "-" + MID(d_phone_number, 4, 3) + "-" + MID(d_phone_number, 7, 4)
  670.     ELSE IF (cp_required = 2) THEN
  671.       hold = "*" + MID(d_phone_number, 1, LEN(country_code)) + "-"  \
  672.                  + MID(d_phone_number, LEN(country_code)+1, LEN(exchange_code)) + "-" \
  673.                  + MID(d_phone_number, LEN(country_code) + LEN(exchange_code) + 1, LEN(d_phone_number) - LEN(country_code) + LEN(exchange_code))
  674.       hold = TRIM(hold, " ")
  675.       d_phone_number = hold + SPACE(24-LEN(hold))
  676.     END IF
  677.  
  678.     hold = d_phone_number + " " + U_NAME() + " " + STRING(TIME()) + " " + STRING(DATE()) + " " + "Data from User Record"
  679.     FPUTLN 1, hold
  680.     RETURN
  681.  
  682. '
  683. '  Clean up telephone numbers from user record
  684. '
  685. :CLEAN_UP_NUMBER
  686.  
  687.     '
  688.     '  Strip characters
  689.     '
  690.     hold = STRIPSTR(hold,"+")
  691.     hold = STRIPSTR(hold,"-")
  692.     hold = STRIPSTR(hold,")")
  693.     hold = STRIPSTR(hold,"(")
  694.     hold = STRIPSTR(hold," ")
  695.     RETURN
  696.  
  697. '
  698. ' Check area code entered by user
  699. '
  700. :CHECK_AREA_CODE
  701.  
  702.    '
  703.    '  Open file and read entries. If a match if found,
  704.    '  FOUND1 is set to TRUE
  705.    '
  706.    IF (cp_required = 1) THEN
  707.      FOPEN 1, PPEPATH() + "AREACODE.DAT", O_RD, S_DN
  708.    ELSE IF (cp_required = 2) THEN
  709.      FOPEN 1, PPEPATH() + "CNTYCODE.DAT", O_RD, S_DN
  710.    END IF
  711.  
  712.    '
  713.    '  Read through file until a match is found
  714.    '
  715.    WHILE (!found1) DO
  716.      FGET 1,hold
  717.      IF (FERR(1)) BREAK
  718.      IF (cp_required = 1) THEN
  719.        IF (MID(hold,1,3) = area_code) found1 = TRUE
  720.        IF (MID(hold,1,3) > area_code) BREAK
  721.      ELSE IF (cp_required = 2) THEN
  722.        IF (MID(hold,1,3) = country_code) found1 = TRUE
  723.      END IF
  724.    END WHILE
  725.    FCLOSE 1
  726.    RETURN
  727.  
  728. '
  729. '  Check exchange entered by user
  730. '
  731. :CHECK_EXCHANGE
  732.  
  733.    '
  734.    '  See if EXCHANGE FILE exists to test for a local phone call
  735.    '
  736.    hold = PPEPATH() + area_code + "XCHNG.DAT"
  737.  
  738.    '
  739.    '  No exchange file found
  740.    '
  741.    IF (!EXIST(hold)) THEN
  742.      FPUTLN 7, "        No Exchange File : ", hold
  743.      RETURN
  744.    END IF
  745.  
  746.    '
  747.    '  Log activity
  748.    '
  749.    FPUTLN 7, "  Searching Exchange File: ", area_code + "XCHNG.DAT"
  750.  
  751.    '
  752.    '  Open file and if a match if found FOUND1 is set to TRUE
  753.    '
  754.    FOPEN 1, hold, O_RD, S_DN
  755.    WHILE (!found1) DO
  756.      FGET 1,hold
  757.      IF (FERR(1)) BREAK
  758.      IF (MID(hold,1,3) = exchange) found1 = TRUE
  759.    END WHILE
  760.    FCLOSE 1
  761.    RETURN
  762.  
  763. '
  764. '  Common exit point for program
  765. '
  766. :EXIT_PROG
  767.  
  768.    '
  769.    '  If not a local call, or user is NOT exiting the PPE,
  770.    '  hangup the modem.  (Disconnect user)
  771.    '
  772.    IF (!local_call) THEN
  773.      IF (ONLOCAL()) THEN
  774.        PRINTLN "Local Testing - User stays online"
  775.        FPUTLN 7, "Local Testing - User stays online"
  776.        GOSUB CLOSE_LOG
  777.      ELSE
  778.        GOSUB CLOSE_LOG
  779.        HANGUP
  780.      END IF
  781.    ELSE
  782.      GOSUB CLOSE_LOG
  783.    END IF
  784.  
  785.    LOG "*** User Exited Callback Program ***", FALSE
  786.    DEFCOLOR
  787.  
  788.    '
  789.    '  If we did not make a connection, turn on carrier detect checking
  790.    '  and keyboard timeout checking before exiting the PPE.
  791.    '
  792.    '  This is *BETA* code here to try to solve a OS/2 problem.
  793.    '
  794.    IF (!made_connection && !ONLOCAL()) THEN
  795.      CDCHKON
  796.      KBDCHKON
  797.    END IF
  798.  
  799.    END
  800.  
  801. '
  802. '
  803. '
  804. :CLOSE_LOG
  805.  
  806.     '
  807.     '  Final logging and close log file
  808.     '
  809.     FPUTLN 7, "   User's Expiration Date: ", U_EXPDATE
  810.     FPUTLN 7, "@@@@@@@@@@@   Ending  CallBack   @@@@@@@@@@@@"
  811.     FCLOSE 7
  812.     RETURN
  813.  
  814.  
  815. '
  816. ' Search trashcan file for sections of callback numbers
  817. ' that are not allowed
  818. '
  819. :TRASH_CAN
  820.  
  821.    '
  822.    '  See if the TRASHCAN.DAT file exists...If not exit the subroutine
  823.    '
  824.    IF (!EXIST(PPEPATH() + "TRASHCAN.DAT")) RETURN
  825.  
  826.    '
  827.    '  Open trashcan file
  828.    '
  829.    FOPEN 1, PPEPATH() + "TRASHCAN.DAT", O_RD, S_DN
  830.  
  831.    '
  832.    '  Get line by line from trashcan file and read 1st 12 characters
  833.    '
  834.    WHILE (1) DO
  835.      FGET 1,hold
  836.      IF (FERR(1)) BREAK
  837.  
  838.      '
  839.      '  See if the line is a comment
  840.      '
  841.      IF (LEFT(hold,1) = "'") CONTINUE
  842.  
  843.      '
  844.      '  If using US calling plan and the entry is International read
  845.      '  the next line
  846.      '
  847.      IF (LEFT(hold,1) = "*" && cp_required = 1) CONTINUE
  848.  
  849.      '
  850.      '  Retrieve the trashcan info from the line
  851.      '
  852.      IF (cp_required = 1) THEN
  853.        hold = MID(hold,1,25)
  854.      ELSE IF (cp_required = 2) THEN
  855.        hold = MID(hold, 2, 24)
  856.      END IF
  857.  
  858.  
  859.      '
  860.      '  Check for trash_type (area code = 1, exchange = 2, last 4 = 3)
  861.      '                       (country code = 4, city code = 5, last nums = 6)
  862.      SELECT CASE (trash_type)
  863.        CASE 1
  864.          '
  865.          '  Check for area codes not allowed, if found exit PPE.
  866.          '
  867.          IF (MID(hold,1,3) = area_code) THEN
  868.            PRINTLN
  869.            PRINTLN "     @X0F*** @X0CThe Area Code "+ area_code +" is @X0Fnot allowed @X0Cfor callback@X07"
  870.            NEWLINE
  871.            FPUTLN 7, "**-->> Area Code matches entry in Trashcan"
  872.            DELAY 54
  873.            GOTO EXIT_PROG
  874.          END IF
  875.        CASE 2
  876.          '
  877.          '  Check for exchange's not allowed, if found exit PPE
  878.          '
  879.          IF (MID(hold,5,3) = exchange) THEN
  880.            PRINTLN
  881.            PRINTLN "     @X0F*** @X0CThe exchange " + exchange +" is @X0Fnot allowed @X0Cfor callback@X07"
  882.            NEWLINE
  883.            FPUTLN 7, "**-->> Exchange matches entry in Trashcan"
  884.            DELAY 54
  885.            GOTO EXIT_PROG
  886.          END IF
  887.        CASE 3
  888.          '
  889.          '  Check for last_4_nums's not allowed, if found exit the PPE.
  890.          '
  891.          IF (MID(hold,9,4) = last_4_nums) THEN
  892.            PRINTLN
  893.            PRINTLN "     @X0F*** @X0CThe last 4 number " + last_4_nums + " are @X0Fnot allowed @X0Cfor callback@X07"
  894.            NEWLINE
  895.            FPUTLN 7, "**-->> Last 4 Numbers matches entry in Trashcan"
  896.            DELAY 54
  897.            GOTO EXIT_PROG
  898.          END IF
  899.        CASE 4
  900.          '
  901.          '  Check for Country Codes not allowed, if found exit PPE
  902.          '
  903.          IF (RTRIM(MID(hold,1,3)," ") = country_code) THEN
  904.            PRINTLN
  905.            PRINTLN "     @X0F*** @X0CThe country code " + country_code +" is @X0Fnot allowed @X0Cfor callback@X07"
  906.            NEWLINE
  907.            FPUTLN 7, "**-->> Exchange matches entry in Trashcan"
  908.            DELAY 54
  909.            GOTO EXIT_PROG
  910.          END IF
  911.        CASE 5
  912.          '
  913.          '  Check for City Codes not allowed, if found exit PPE
  914.          '
  915.          IF (RTRIM(MID(hold,5,4)," ") = exchange_code) THEN
  916.            PRINTLN
  917.            PRINTLN "     @X0F*** @X0CThe city code " + exchange_code +" is @X0Fnot allowed @X0Cfor callback@X07"
  918.            NEWLINE
  919.            FPUTLN 7, "**-->> Exchange matches entry in Trashcan"
  920.            DELAY 54
  921.            GOTO EXIT_PROG
  922.          END IF
  923.        CASE 6
  924.          '
  925.          '  Check for last numbers not allowed, if found exit PPE
  926.          '
  927.          IF (RTRIM(MID(hold,10,8)," ") = last_nums) THEN
  928.            PRINTLN
  929.            PRINTLN "     @X0F*** @X0CThe last numbers " + last_nums +" are @X0Fnot allowed @X0Cfor callback@X07"
  930.            NEWLINE
  931.            FPUTLN 7, "**-->> Exchange matches entry in Trashcan"
  932.            DELAY 54
  933.            GOTO EXIT_PROG
  934.          END IF
  935.      END SELECT
  936.    END WHILE
  937.    FCLOSE 1
  938.    RETURN
  939.  
  940. '
  941. '  Read CB.CFG  - Configuration file
  942. '
  943. :READ_CFG
  944.  
  945.    '
  946.    '
  947.    '
  948.    NEWLINE
  949.    PRINTLN "@X03Reading configuration.....@X07"
  950.  
  951.    '
  952.    '  Check for node specific .CFG file.  If not found use CB.CFG
  953.    '
  954.    IF (EXIST(PPEPATH() + "CB" + STRING(PCBNODE()) + ".CFG")) THEN
  955.      FPUTLN 7, " Using configuration file: ", "CB" + STRING(PCBNODE()) + ".CFG"
  956.      FOPEN 1, PPEPATH() + "CB" + STRING(PCBNODE()) + ".CFG", O_RD, S_DN
  957.    ELSE
  958.      FOPEN 1, PPEPATH() + "CB.CFG", O_RD, S_DN
  959.      IF (FERR(1)) THEN
  960.        NEWLINE
  961.        PRINTLN "Configuration file (CB.CFG) NOT FOUND!!....Program Aborting"
  962.        NEWLINE
  963.        FPUTLN 7, "**-->> Configuration File Not Found!!!! - CB.CFG - Program Aborted"
  964.        WAIT
  965.        GOTO EXIT_PROG
  966.      END IF
  967.      FPUTLN 7, " Using configuration file: CB.CFG"
  968.    END IF
  969.  
  970.    '
  971.    '  Initialize line counter
  972.    '
  973.    count = 1
  974.    WHILE (1) DO
  975.  
  976.      '
  977.      ' Check how many lines we have read from .CFG file
  978.      '
  979.      IF (count > 26) BREAK
  980.      FGET 1, hold
  981.      hold = TRIM(hold," ")
  982.  
  983.      '
  984.      ' Make sure we have read AT LEAST 26 Lines or else the .CFG file is wrong
  985.      '
  986.      IF (FERR(1) && count < 26) THEN
  987.        FPUTLN 7, "##### CONFIGURATION FILE DOES NOT CONTAIN 26 ENTRIES #####"
  988.        GOTO EXIT_PROG
  989.      END IF
  990.  
  991.      '
  992.      '  See if the line is a comment
  993.      '
  994.      IF (LEFT(hold,1) = "#" || LEFT(hold,1) = "'") CONTINUE
  995.  
  996.      '
  997.      '  Process the line we just read (count)
  998.      '
  999.      SELECT CASE (count)
  1000.        CASE 1
  1001.          highest_sec_level_allowed = TOINT(hold)
  1002.        CASE 2
  1003.          TOKENIZE hold
  1004.          verification_type = UPPER(GETTOKEN())
  1005.          verification_entry_count = TOINT(GETTOKEN())
  1006.        CASE 3
  1007.          cb_remain_number = TOFLOAT(hold)
  1008.        CASE 4
  1009.          init_string = UPPER(hold)
  1010.        CASE 5
  1011.          local_time_to_call = TOINT(hold)
  1012.        CASE 6
  1013.          ld_time_to_call = TOINT(hold)
  1014.        CASE 7
  1015.          area_code_local = hold
  1016.        CASE 8
  1017.          local_no_area_code = hold
  1018.        CASE 9
  1019.          TOKENIZE hold
  1020.          local_start_time = GETTOKEN()
  1021.          local_end_time = GETTOKEN()
  1022.        CASE 10
  1023.          TOKENIZE hold
  1024.          IF (!INSTR(hold, "DISABLED")) THEN
  1025.            ld_start_time = GETTOKEN()
  1026.            ld_end_time = GETTOKEN()
  1027.          ELSE
  1028.            block_ld_callbacks = TRUE
  1029.          END IF
  1030.        CASE 11
  1031.          IF (hold != "") THEN
  1032.            TOKENIZE hold
  1033.            msg_conf_num = TOLONG(GETTOKEN())
  1034.            msg_text_file = GETTOKEN()
  1035.          END IF
  1036.        CASE 12
  1037.          IF (UPPER(hold) = "TRUE") use_other = TRUE
  1038.        CASE 13
  1039.          IF (UPPER(hold) = "TRUE") ck_area_code = TRUE
  1040.        CASE 14
  1041.          IF (UPPER(hold) = "TRUE") ck_exchange = TRUE
  1042.        CASE 15
  1043.          IF (UPPER(hold) = "TRUE") up_already_verified = TRUE
  1044.        CASE 16
  1045.          busy_value = TOFLOAT(hold)
  1046.        CASE 17
  1047.          no_dial_value = TOFLOAT(hold)
  1048.        CASE 18
  1049.          ring_value = TOFLOAT(hold)
  1050.        CASE 19
  1051.          hold = REPLACESTR (hold," ","_")
  1052.          TOKENIZE hold
  1053.          hold2 = UPPER(GETTOKEN())
  1054.          IF (hold2 = "TRUE") THEN
  1055.            process_caller_id = TRUE
  1056.            hold2 = UPPER(GETTOKEN())
  1057.            IF (hold2 = "TRUE") upgrade_caller_id = TRUE
  1058.            cid_string_to_search = UPPER(GETTOKEN())
  1059.            cid_string_to_search = REPLACESTR(cid_string_to_search,"_"," ")
  1060.            add_ac_to_cid = GETTOKEN()
  1061.            hold2 = UPPER(GETTOKEN())
  1062.            IF (hold2 = "H") cid_use_hex = TRUE
  1063.            hold2 = UPPER(GETTOKEN())
  1064.            IF (hold2 = "TRUE") THEN
  1065.              stop_blocked_cid_caller = TRUE
  1066.              blocked_cid_string = UPPER(GETTOKEN())
  1067.            END IF
  1068.          END IF
  1069.        CASE 20
  1070.          dialing_string = hold
  1071.        CASE 21
  1072.          TOKENIZE hold
  1073.          dialing_prefix = GETTOKEN()
  1074.          dialing_suffix = GETTOKEN()
  1075.          '
  1076.          '  Suffix Use Codes
  1077.          '
  1078.          ' "A" - all the time, "D" - LD only, "L" - local only
  1079.          '
  1080.          suffix_use = UPPER(GETTOKEN())
  1081.        CASE 22
  1082.          TOKENIZE hold
  1083.          ld_prefix = GETTOKEN()
  1084.          intl_ld_prefix = GETTOKEN()
  1085.        CASE 23
  1086.          post_cbinfo_user_record = UPPER(hold)
  1087.        CASE 24
  1088.          TOKENIZE hold
  1089.          us_min_phone_number_length = TOINT(GETTOKEN())
  1090.          intl_min_phone_number_length = TOINT(GETTOKEN())
  1091.        CASE 25
  1092.          TOKENIZE hold
  1093.          hold2 = UPPER(GETTOKEN())
  1094.          IF (hold2 = "US" || hold2 = "BOTH") us_call_plan = TRUE
  1095.          IF (hold2 = "INTL" || hold2 = "BOTH") THEN
  1096.            intl_call_plan = TRUE
  1097.            hold2 = UPPER(GETTOKEN())
  1098.            IF (hold2 = "TRUE") prompt_for_zero = TRUE
  1099.          END IF
  1100.        CASE 26
  1101.          IF (UPPER(hold) != "FALSE") drop_ld_cb = TRUE
  1102.      END SELECT
  1103.      '
  1104.      '  Increment configuration read counter
  1105.      '
  1106.      INC count
  1107.      '
  1108.    END WHILE
  1109.  
  1110.    '
  1111.    '  Done...Close the file
  1112.    '
  1113.    FCLOSE 1
  1114.    RETURN
  1115.  
  1116. '
  1117. ' Check to see if their security level is too high to use the program
  1118. '
  1119. :SECURITY_CHECK
  1120.  
  1121.    IF (U_SEC > highest_sec_level_allowed) THEN
  1122.      PRINTLN
  1123.      PRINTLN "@X4FSecurity Level Too High@X0F....@X0EReturning to the BBS"
  1124.      NEWLINE
  1125.      FPUTLN 7, "**-->> Security Level too high = ", U_SEC
  1126.      DELAY 36
  1127.      GOTO EXIT_PROG
  1128.    END IF
  1129.    RETURN
  1130.  
  1131. '
  1132. ' Check to see if the username is in the BAD-NAME.LST file
  1133. '
  1134. ' Format of file is one username per line
  1135. '
  1136. :BAD_NAMES
  1137.  
  1138.    '
  1139.    '  Check for existence of BAD NAMES file.  If found, check file for
  1140.    '  a match to current username.  If found display the file BADN and
  1141.    '  exit the PPE
  1142.    '
  1143.    hold2 = PPEPATH() + "BAD-NAME.LST"
  1144.    IF (EXIST(hold2)) THEN
  1145.      FPUTLN 7, "Checking Username against: BAD-NAME.LST"
  1146.      FOPEN 1, hold2, O_RD, S_DN
  1147.  
  1148.      '
  1149.      '  Read file till value is matched or EOF is reached
  1150.      '
  1151.      WHILE (1) DO
  1152.        '
  1153.        FGET 1, hold
  1154.        IF (FERR(1)) BREAK
  1155.  
  1156.        '
  1157.        '  If a comment, read the next line
  1158.        '
  1159.        IF (LEFT(hold,1) = "'") CONTINUE
  1160.  
  1161.        '
  1162.        '  See if names match
  1163.        '
  1164.        IF (UPPER(TRIM(U_NAME()," ")) = UPPER(TRIM(hold," "))) THEN
  1165.          DISPFILE PPEPATH() + "BADNAM", GRAPH+LANG+SEC
  1166.          FPUTLN 7, "**-->>    Matched name in: BAD-NAME.LST...Exit Callback"
  1167.          DELAY 36
  1168.          GOTO EXIT_PROG
  1169.        END IF
  1170.        '
  1171.      END WHILE
  1172.  
  1173.      '
  1174.      '  If we got to here, no matching name was found.  Log
  1175.      '  the results and close the file
  1176.      '
  1177.      FPUTLN 7, "        No match found in: BAD-NAME.LST"
  1178.      FCLOSE 1
  1179.      '
  1180.    END IF
  1181.    RETURN
  1182.  
  1183. '
  1184. '  Ask user which phone number from USER record to use for Callback
  1185. '
  1186. :PROCESS_USER_RECORD_PHONE
  1187.  
  1188.      NEWLINES 2
  1189.      PRINTLN "      @X0FYou have the following phone numbers in your user record"
  1190.      NEWLINE
  1191.      PRINTLN "      @X0ABusiness/Data Phone Number@X0F: [@X0CD@X0F] - @X02", U_BDPHONE
  1192.      PRINTLN "      @X0AHome/Voice Phone Number   @X0F: [@X0CH@X0F] - @X02", U_HVPHONE
  1193.  
  1194.      '
  1195.      '  Optional prompt to display to user.  Will allow
  1196.      '  them to use an "other" phone number for callback.
  1197.      '
  1198.      IF (use_other) PRINTLN "      @X0AUse Other Phone Number    @X0F: [@X0CO@X0F]@X03ther"
  1199.      NEWLINE
  1200.  
  1201.      '
  1202.      '  Allow the "O" character to be used for a response when the
  1203.      '  user is prompted for which phone number to use for callback
  1204.      '
  1205.      IF (use_other) THEN
  1206.        main_prompt = "  Which number do you wish to use for your callback number (D/H/O)"
  1207.        user_input = "D"
  1208.        INPUTSTR main_prompt, user_input, @X0E, 1,"DHO", FIELDLEN+GUIDE+LFAFTER+UPCASE
  1209.      ELSE
  1210.        main_prompt = "  Which number do you wish to use for your callback number (D/H)"
  1211.        user_input = "D"
  1212.        INPUTSTR main_prompt, user_input, @X0E, 1,"DH", FIELDLEN+GUIDE+LFAFTER+UPCASE
  1213.      END IF
  1214.  
  1215.      '
  1216.      '  Retrieve and "clean" data and voice user record phone numbers
  1217.      '
  1218.      GOSUB PREPARE_DATA_VOICE_NUMBERS
  1219.  
  1220.      '
  1221.      '  User did not choose OTHER, so process their request for
  1222.      '  proper phone number
  1223.      '
  1224.      IF (user_input != "O") THEN
  1225.  
  1226.        improper_user_rec_phone = FALSE
  1227.        '
  1228.        '  Set variables and log information depending on
  1229.        '  if the user decided to use their voice or data
  1230.        '  phone number for callback.
  1231.        IF (user_input = "D") phone_number = d_phone_number
  1232.        IF (user_input = "H") phone_number = h_phone_number
  1233.  
  1234.        '
  1235.        '  Set length to check user record phone number
  1236.        '
  1237.        IF (cp_required = 1) THEN
  1238.          ck_length = us_min_phone_number_length
  1239.        ELSE IF (cp_required = 2) THEN
  1240.          ck_length = intl_min_phone_number_length
  1241.        END IF
  1242.  
  1243.        '
  1244.        '  Check if the phone number in the USERS RECORD is at
  1245.        '  equal to ck_length characters long (defined in configuration).
  1246.        '  If not inform user by displaying information, then
  1247.        '  allowing the user to enter in their phone number
  1248.        '  manually.
  1249.        '
  1250.        IF (LEN(phone_number) != ck_length) THEN
  1251.          NEWLINE
  1252.          PRINTLN "  @X0FImproper phone number in user file - @X0CSysOp Notified@X0F!!@X07"
  1253.          IF (user_input = "D") FPUTLN 7, "**-->> (D) Improper phone number in user file: ", U_BDPHONE
  1254.          IF (user_input = "H") FPUTLN 7, "**-->> (H) Improper phone number in user file: ", U_HVPHONE
  1255.          improper_user_rec_phone = TRUE
  1256.          phone_number = ""
  1257.          DELAY 54
  1258.        ELSE
  1259.          user_record_phone = TRUE
  1260.          IF (user_input = "D") FPUTLN 7, "        Phone number used: Data Number from User Record"
  1261.          IF (user_input = "H") FPUTLN 7, "        Phone number used: Voice Number from User Record"
  1262.        END IF
  1263.  
  1264.        '
  1265.        '  Break up phone number into component parts depending
  1266.        '  on calling plan
  1267.        '
  1268.        IF (user_record_phone && cp_required = 1) THEN
  1269.          area_code = MID(phone_number, 1, 3)
  1270.          exchange = MID(phone_number, 4, 3)
  1271.          last_4_nums = MID(phone_number, 7, 4)
  1272.          log_entry = area_code + "-" + exchange + "-" + last_4_nums
  1273.        ELSE IF (user_record_phone && cp_required = 2) THEN
  1274.          country_code = TRIM(MID(phone_number, 1, 3)," ")
  1275.          exchange_code = TRIM(MID(phone_number, 4, 4)," ")
  1276.          last_nums = TRIM(MID(phone_number, 8, 8)," ")
  1277.          log_entry = country_code + "-" + exchange_code + "-" + last_nums
  1278.        END IF
  1279.        '
  1280.      ELSE
  1281.        FPUTLN 7, "        Phone number used: User Entered 'OTHER' Phone Number"
  1282.      END IF
  1283.  
  1284.      RETURN
  1285.  
  1286. '
  1287. '  Prompt user for their phone number -OR- check phone number
  1288. '  user used from their USER RECORD entry
  1289. '
  1290. :GET_PROCESS_PHONE_NUMBER
  1291.  
  1292.  
  1293.    '
  1294.    '  Clear out variables to accept new phone number only if we
  1295.    '  are NOT using phone numbers from user record
  1296.    '
  1297.    IF (!user_record_phone && cp_required = 1) THEN
  1298.      area_code = ""
  1299.      exchange = ""
  1300.      last_4_nums = ""
  1301.    ELSE IF (!user_record_phone && cp_required = 2) THEN
  1302.      country_code = ""
  1303.      exchange_code = ""
  1304.      last_nums = ""
  1305.    END IF
  1306.  
  1307.  
  1308.    '
  1309.    '  Prompt/process AREACODE, EXCHANGE, & LAST 4 when we are
  1310.    '  using the US calling plan, COUNTRY CODE, CITY CODE & LAST
  1311.    '  when we are using INTL calling plan
  1312.    '
  1313.  
  1314.    '
  1315.    '   Get AREACODE/COUNTRY CODE
  1316.    '
  1317.    IF (cp_required = 1) THEN
  1318.      main_prompt = "   @X0APlease enter your Area Code: @X0F"
  1319.      IF (area_code = "") NEWLINE
  1320.      user_input = area_code
  1321.      ck_length = 3
  1322.      inp_length = 3
  1323.    ELSE IF (cp_required = 2) THEN
  1324.      main_prompt = "@X0APlease enter your Country Code: @X0F"
  1325.      IF (country_code = "") NEWLINE
  1326.      user_input = country_code
  1327.      ck_length = 1
  1328.      inp_length = 3
  1329.    END IF
  1330.  
  1331.    WHILE (LEN(user_input) < ck_length) DO
  1332.      user_input = ""
  1333.      INPUTSTR main_prompt, user_input, @X0F, inp_length, MASK_NUM(), FIELDLEN+GUIDE+LFAFTER
  1334.    END WHILE
  1335.  
  1336.    IF (cp_required = 1) THEN
  1337.      area_code = user_input
  1338.      FPUTLN 7, "                Area Code: ", area_code
  1339.      trash_type = 1
  1340.    ELSE IF (cp_required = 2) THEN
  1341.      country_code = user_input
  1342.      FPUTLN 7, "             Country Code: ", country_code
  1343.      trash_type = 4
  1344.    END IF
  1345.  
  1346.    '
  1347.    '  Check TrashCan for AreaCode/Country Code Violation
  1348.    '
  1349.    GOSUB TRASH_CAN
  1350.  
  1351.    '
  1352.    ' Check to see if we are to use AREACODE.DAT or CNTYCODE.DAT and then
  1353.    ' check to see if area code entered by user is found in the file
  1354.    '
  1355.    ' found1 = FALSE when no match was found
  1356.    '
  1357.    IF (ck_area_code) THEN
  1358.      GOSUB CHECK_AREA_CODE
  1359.    ELSE
  1360.      found1 = TRUE
  1361.    END IF
  1362.  
  1363.    '
  1364.    '  Users area code was not allowed for long distance calling so abort
  1365.    '
  1366.    IF (!found1) THEN
  1367.       PRINTLN
  1368.  
  1369.       IF (cp_required = 1) THEN
  1370.         PRINTLN "@X0CArea Code @X0E" + area_code + "@X0C Is Not Allowed For Call Back@X07"
  1371.         FPUTLN 7, "   Area Code not in .DAT = ", area_code
  1372.         LOG "** Area Code Not allowed in Callback **", FALSE
  1373.       ELSE IF (cp_required = 2) THEN
  1374.         PRINTLN "@X0CCountry Code @X0E" + country_code + "@X0C Is Not Allowed For Call Back@X07"
  1375.         FPUTLN 7, "Country Code not in .DAT = ", country_code
  1376.         LOG "** Country Code Not allowed in Callback **", FALSE
  1377.       END IF
  1378.  
  1379.       NEWLINE
  1380.       PRINTLN "@X0BInform the sysop if you believe there is a problem, Thanks.@X07"
  1381.       DELAY 36
  1382.       GOTO EXIT_PROG
  1383.    ELSE
  1384.       found1 = FALSE
  1385.    END IF
  1386.  
  1387.  
  1388.    '
  1389.    ' Force user to enter a three digit exchange for US
  1390.    ' dialing plan, or up to a 4 digit city code for INTL
  1391.    ' dialing plan
  1392.    '
  1393.    ' Get EXCHANGE/CITY CODE
  1394.    '
  1395.    IF (cp_required = 1) THEN
  1396.      main_prompt = "           @X0AEnter your Exchange: @X0F"
  1397.      user_input = exchange
  1398.      ck_length = 3
  1399.      inp_length = 3
  1400.    ELSE IF (cp_required = 2) THEN
  1401.      main_prompt = "          @X0AEnter your City Code: @X0F"
  1402.      user_input = exchange_code
  1403.      ck_length = 1
  1404.      inp_length = 4
  1405.    END IF
  1406.  
  1407.    WHILE (LEN(user_input) < ck_length) DO
  1408.      user_input = ""
  1409.      INPUTSTR main_prompt, user_input, @X0F, inp_length, MASK_NUM(), FIELDLEN+GUIDE+LFAFTER
  1410.    END WHILE
  1411.  
  1412.    IF (cp_required = 1) THEN
  1413.      exchange = user_input
  1414.      FPUTLN 7, "                 Exchange: ", exchange
  1415.      trash_type = 2
  1416.    ELSE IF (cp_required = 2) THEN
  1417.      exchange_code = user_input
  1418.      FPUTLN 7, "                City Code: ", exchange_code
  1419.      trash_type = 5
  1420.    END IF
  1421.  
  1422.    '
  1423.    '  Check TrashCan for Exchange Violation
  1424.    '
  1425.    GOSUB TRASH_CAN
  1426.  
  1427.    '
  1428.    '  If US Dialing plan see if xxxXCHNG.DAT files are to be used
  1429.    '
  1430.    IF (cp_required = 1 && !intl_callback) THEN
  1431.      '
  1432.      '  Check Exchange for local or long distance call to be made
  1433.      '  Check to see if area code is ALWAYS a local call (from .CFG file)
  1434.      '
  1435.      IF (INSTR(area_code_local,area_code) = 0) THEN
  1436.        IF (ck_exchange) GOSUB CHECK_EXCHANGE  ' found1 = TRUE if match found
  1437.      ELSE
  1438.        found1 = TRUE
  1439.      END IF
  1440.  
  1441.      '
  1442.      '  If checking for the xxxXCHNG.DAT file and the
  1443.      '  exchange is found (found1 = TRUE), it is a
  1444.      '  local call
  1445.      '
  1446.      IF (ck_exchange) THEN
  1447.        IF (found1) THEN
  1448.          local_call = TRUE
  1449.          hold = "TRUE"
  1450.        ELSE
  1451.          local_call = FALSE
  1452.          hold = "FALSE"
  1453.        END IF
  1454.        FPUTLN 7, "               Local Call: ", hold
  1455.      END IF
  1456.    END IF          ' cp_required = 1
  1457.  
  1458.    '
  1459.    ' Get last 4 or last 8 numbers
  1460.    '
  1461.    IF (cp_required = 1) THEN
  1462.      main_prompt = "       @X0AEnter the last 4 digits: @X0F"
  1463.      user_input = last_4_nums
  1464.      ck_length = 4
  1465.      inp_length = 4
  1466.    ELSE IF (cp_required = 2) THEN
  1467.      main_prompt = "       @X0AEnter remaining numbers: @X0F"
  1468.      user_input = last_nums
  1469.      ck_length = 1
  1470.      inp_length = 8
  1471.    END IF
  1472.  
  1473.    WHILE (LEN(user_input) < ck_length) DO
  1474.      user_input = ""
  1475.      INPUTSTR main_prompt, user_input, @X0F, inp_length, MASK_NUM(), FIELDLEN+GUIDE+LFAFTER
  1476.    END WHILE
  1477.  
  1478.    IF (cp_required = 1) THEN
  1479.      last_4_nums = user_input
  1480.      FPUTLN 7, "           Last 4 Numbers: ", last_4_nums
  1481.      trash_type = 3
  1482.    ELSE IF (cp_required = 2) THEN
  1483.      last_nums = user_input
  1484.      FPUTLN 7, "             Last Numbers: ", last_nums
  1485.      trash_type = 6
  1486.    END IF
  1487.  
  1488.    '
  1489.    '  Check TrashCan for Last 4 number Violation
  1490.    '
  1491.    GOSUB TRASH_CAN
  1492.  
  1493.    '  If "area_code" equals the "area_code_local" (always a local call)
  1494.    '  then do not propmt the user for local or long distance, the call
  1495.    '  is ALWAYS a local call.
  1496.    '
  1497.    '
  1498.    '  This section will either ask the user if the call is local
  1499.    '  or long distance or the program will automatically set the
  1500.    '  local_call variable for true or false (based on xxxXCHNG.DAT)
  1501.    '
  1502.    IF (cp_required = 1 && !intl_callback) THEN
  1503.      IF (!ck_exchange) THEN
  1504.        IF (area_code != area_code_local) THEN
  1505.          GOSUB ASK_LOCAL_LD
  1506.        ELSE
  1507.          local_call = TRUE
  1508.          FPUTLN 7, "               Local Call: ALWAYS TRUE AREACODE"
  1509.        END IF
  1510.      END IF
  1511.    ELSE IF (cp_required = 1 && intl_callback) THEN
  1512.      local_call = FALSE
  1513.    ELSE IF (cp_required = 2) THEN
  1514.      IF (!intl_callback) THEN
  1515.        GOSUB ASK_LOCAL_LD
  1516.        IF (prompt_for_zero) THEN
  1517.          '
  1518.          ' In the U.K. you need to add a leading 0 to the dialing code
  1519.          ' when making a phone call within the U.K. to another part of
  1520.          ' the U.K.
  1521.          '
  1522.          PRINTLN "@X0ESome countries require a '0' to preceed the phone number to"
  1523.          PRINTLN "make a phone call within the same country.  With this in mind..."
  1524.          main_prompt = "@X0ADoes this call to you, require a '0' to preceed the number@X07"
  1525.          hold2 = NOCHAR()
  1526.          INPUTYN main_prompt, hold2, @X0E
  1527.          IF (hold2 = YESCHAR()) exchange_code = "0" + exchange_code
  1528.          NEWLINE
  1529.        END IF
  1530.      ELSE
  1531.        local_call = FALSE
  1532.      END IF
  1533.    END IF
  1534.  
  1535.    '
  1536.    '  Build phone number variables (phone_number, log_entry) - used later on
  1537.    '
  1538.    IF (cp_required = 1) THEN
  1539.      phone_number = area_code + exchange + last_4_nums
  1540.      log_entry = area_code + "-" + exchange + "-" + last_4_nums
  1541.    ELSE IF (cp_required = 2) THEN
  1542.      phone_number = country_code + exchange_code + last_nums
  1543.      log_entry = country_code + "-" + exchange_code + "-" + last_nums
  1544.    END IF
  1545.  
  1546.    '
  1547.    '  Log the phone number the user entered
  1548.    '
  1549.    FPUTLN 7, "     Phone Number Entered: ", log_entry
  1550.    RETURN
  1551.  
  1552. '
  1553. '  Ask the user if the call is LOCAL or Long Distance
  1554. '
  1555. :ASK_LOCAL_LD
  1556.  
  1557.    '
  1558.    '  Build string to prompt the user - Default answer = YES - Local call
  1559.    '
  1560.    NEWLINE
  1561.    main_prompt = "  @X0C" + log_entry + "@X0F - @X0EIs this a Local Phone Call @X0F(@X02Y/N@X0F)"
  1562.    hold2 = YESCHAR()
  1563.  
  1564.    '
  1565.    '  Prompt and get yes/no response from user
  1566.    '
  1567.    INPUTYN main_prompt, hold2, @X0E
  1568.  
  1569.    '
  1570.    '  Read response and look for LANGUAGE SPECIFIC "YES" answer
  1571.    '
  1572.    IF (hold2 = YESCHAR()) THEN
  1573.      local_call = TRUE
  1574.      FPUTLN 7, "               Local Call: TRUE - CHOSEN BY USER"
  1575.    ELSE
  1576.      local_call = FALSE
  1577.      FPUTLN 7, "               Local Call: FALSE - CHOSEN BY USER"
  1578.    END IF
  1579.    NEWLINE
  1580.    RETURN
  1581.  
  1582. '
  1583. '  See if the call is local or LD and check the times allowed to call
  1584. '
  1585. :CK_ALLOWED_TIMES
  1586.  
  1587.    '
  1588.    '  Check for Local or LD call, and determine if current time
  1589.    '  is within callback time. The flag file no_call will be set
  1590.    '  to TRUE if callback is not allowed at the current time.
  1591.    '
  1592.    no_call = FALSE
  1593.  
  1594.    IF (local_call) THEN
  1595.      '
  1596.      '  Local Call
  1597.      '
  1598.      IF (local_end_time < local_start_time) THEN
  1599.        IF (TIME() < local_start_time && TIME() > local_end_time) no_call = TRUE
  1600.      ELSE IF (local_end_time > local_start_time) THEN
  1601.        IF (TIME() < local_start_time || TIME() > local_end_time) no_call = TRUE
  1602.      END IF
  1603.      '
  1604.      '  Log information
  1605.      '
  1606.      FPUTLN 7, " Local Allowed Start Time: ", local_start_time
  1607.      FPUTLN 7, "   Local Allowed End Time: ", local_end_time
  1608.      FPUTLN 7, "          Current time is: ", TIME()
  1609.      '
  1610.    END IF
  1611.    '
  1612.    IF (!local_call && !block_ld_callbacks) THEN
  1613.      '
  1614.      '  Long Distance Call
  1615.      '
  1616.      IF (ld_end_time < ld_start_time) THEN
  1617.        IF (TIME() < ld_start_time && TIME() > ld_end_time) no_call = TRUE
  1618.      ELSE IF (ld_end_time > ld_start_time) THEN
  1619.        IF (TIME() < ld_start_time || TIME() > ld_end_time) no_call = TRUE
  1620.      END IF
  1621.  
  1622.      '
  1623.      '  Log information
  1624.      '
  1625.      FPUTLN 7, "    LD Allowed Start Time: ", ld_start_time
  1626.      FPUTLN 7, "      LD Allowed End Time: ", ld_end_time
  1627.      FPUTLN 7, "          Current time is: ", TIME()
  1628.      '
  1629.    ELSE IF (!local_call && block_ld_callbacks) THEN
  1630.      '
  1631.      '  If callback is outside allowed hours -OR- the sysop
  1632.      '  is blocking all Long Disntance callbacks, show file (LCNO/LDNO)
  1633.      '  informing user and exit the callback program
  1634.      '
  1635.      FPUTLN 7, "  Long Distance Callback Blocked - ** No Callback performed **"
  1636.      DISPFILE PPEPATH() + "ldno", LANG+GRAPH+SEC
  1637.      local_call = TRUE
  1638.      GOTO EXIT_PROG
  1639.      '
  1640.    END IF
  1641.  
  1642.    IF (no_call) THEN
  1643.      FPUTLN 7, "    Callback within hours: FALSE - ** No Callback performed **"
  1644.      IF (local_call) THEN
  1645.        DISPFILE PPEPATH() + "lcno", LANG+GRAPH+SEC
  1646.      ELSE
  1647.        DISPFILE PPEPATH() + "ldno", LANG+GRAPH+SEC
  1648.      END IF
  1649.      local_call = TRUE
  1650.      GOTO EXIT_PROG
  1651.    END IF
  1652.  
  1653.    '
  1654.    '  Call back is within allowed hours.  Add to LOG
  1655.    '
  1656.    FPUTLN 7, "    Callback within hours: TRUE"
  1657.    RETURN
  1658.  
  1659. '
  1660. '  Open the proper security file for local or long distance caller
  1661. '
  1662. :READ_SECURITY_FILE
  1663.  
  1664.    '
  1665.    '  Check for existence of security files.  If found Open the files,
  1666.    '  if not found, inform caller and log error.
  1667.    '
  1668.    found1 = FALSE
  1669.    IF (local_call) THEN
  1670.      IF (!EXIST(PPEPATH() + "LC-SL.CFG")) THEN
  1671.        NEWLINES 3
  1672.        PRINTLN "Local Security File MISSING - Inform SysOp Immediately!!"
  1673.        FPUTLN 7, "**-->> Local Security (LC-SL.CFG) File MISSING!!"
  1674.        DELAY 54
  1675.        GOTO EXIT_PROG
  1676.      END IF
  1677.      FOPEN 1, PPEPATH() + "LC-SL.CFG", O_RD, S_DN
  1678.    ELSE
  1679.      IF (!EXIST(PPEPATH() + "LD-SL.CFG")) THEN
  1680.        NEWLINES 3
  1681.        PRINTLN "Long Distance Security File MISSING - Inform SysOp Immediately!!"
  1682.        FPUTLN 7, "**-->> Long Distance Security (LD-SL.CFG) File MISSING!!"
  1683.        DELAY 54
  1684.        GOTO EXIT_PROG
  1685.      END IF
  1686.      FOPEN 1, PPEPATH() + "LD-SL.CFG", O_RD, S_DN
  1687.    END IF
  1688.  
  1689.    '
  1690.    '  Find the matching security level and assign the appropriate
  1691.    '  security levels and expiration dates for success and failure
  1692.    '  of callback,
  1693.    '
  1694.    WHILE (1) DO
  1695.  
  1696.      '
  1697.      '  Get line from ??-SL.CFG file
  1698.      '
  1699.      FGET 1, hold
  1700.  
  1701.      '
  1702.      ' If error reading from file (end of file), users security level
  1703.      ' *probably* was not matched -OR- the ??-SL.CFG file was not present.
  1704.      '
  1705.      IF (FERR(1)) THEN
  1706.        IF (!found1) THEN
  1707.          LOG "*** Cannot find matching security level in ??-SL.CFG", FALSE
  1708.          FPUTLN 7, "*** Cannot find matching security level in ??-SL.CFG"
  1709.          NEWLINES 3
  1710.          PRINTLN "@X0CYour security level was not found by program - @X0FInform SysOp ASAP!!!@X07"
  1711.          NEWLINES 2
  1712.          WAIT
  1713.          local_call = TRUE
  1714.          GOTO EXIT_PROG
  1715.        END IF
  1716.      END IF
  1717.  
  1718.      '
  1719.      '  If comment line, read the next line
  1720.      '
  1721.      IF (LEFT(hold,1) = "#" || LEFT(hold,1) = "'") CONTINUE
  1722.  
  1723.      '
  1724.      '  See if we match the users security level.  If we match
  1725.      '  then read in all the parameters into their variables
  1726.      '
  1727.      IF (U_SEC = TOINT(MID(hold, 1, INSTR(hold,";")-1))) THEN
  1728.        '
  1729.        '  Tokenize the line we retrieved from security file
  1730.        '  and get the component parts and assign to proper
  1731.        '  variables.
  1732.        '
  1733.        found1 = TRUE
  1734.        TOKENIZE hold
  1735.        '
  1736.        '  Put matching security level (1st parmameter) into generic variable
  1737.        '  as we dont need it
  1738.        '
  1739.        user_input = GETTOKEN()
  1740.        '
  1741.        '  Retreive remaining parameters
  1742.        '
  1743.        verified_level = TOINT(GETTOKEN())
  1744.        failure_level = TOINT(GETTOKEN())
  1745.        expired_level = TOINT(GETTOKEN())
  1746.        adjust_mins = TOINT(GETTOKEN())
  1747.        expired_date_days = TOINT(GETTOKEN())
  1748.  
  1749.        '
  1750.        '  Log information about security levels
  1751.        '
  1752.        FPUTLN 7, "       Verified Sec Level: ", verified_level
  1753.        FPUTLN 7, "        Failure Sec Level: ", failure_level
  1754.        FPUTLN 7, "        Expired Sec Level: ", expired_level
  1755.        FPUTLN 7, "          Time Adjustment: ", adjust_mins
  1756.  
  1757.        '
  1758.        '  Log what the user new expiration date will be
  1759.        '
  1760.        IF (expired_date_days != 0) THEN
  1761.          FPUT 7, "   Days till Expired Date: ", expired_date_days, " = ", TODATE(DATE() + expired_date_days)
  1762.        ELSE
  1763.          FPUT 7, "   Days till Expired Date: ", expired_date_days, " = 00/00/00"
  1764.        END IF
  1765.        FPUTLN 7, " - (If Callback is successful)"
  1766.  
  1767.        '
  1768.        '  Exit routine due to finding security level match
  1769.        '
  1770.        BREAK
  1771.      ELSE
  1772.        CONTINUE
  1773.      END IF
  1774.      '
  1775.    END WHILE
  1776.    FCLOSE 1
  1777.    RETURN
  1778.  
  1779. '
  1780. ' Search VERIFIED.LOG for verified phone numbers
  1781. '
  1782. :CK_VERIFIED_LOG
  1783.  
  1784.    do_increase = FALSE
  1785.    PRINT "@X02Checking entries in verified log for duplicates: @X0F"
  1786.    count = 0
  1787.    PRINT "    "
  1788.  
  1789.    '
  1790.    '  Check for existance of VERIFIED.LOG
  1791.    '
  1792.    IF (!EXIST(PPEPATH() + "VERIFIED.LOG")) THEN
  1793.      FPUTLN 7, "**-->> VERIFIED.LOG is not found"
  1794.      RETURN
  1795.    END IF
  1796.  
  1797.    '
  1798.    '  Verified.Log file found.  Check to see if user has
  1799.    '  already been verified.
  1800.    '
  1801.    FOPEN 1, PPEPATH() + "VERIFIED.LOG", O_RD, S_DN
  1802.    WHILE (1) DO
  1803.  
  1804.      '
  1805.      '  Retrieve an entry from the verified.log file
  1806.      '
  1807.      FGET 1,hold
  1808.  
  1809.      '
  1810.      '  IF (EOF), or error, stop reading the file.
  1811.      '
  1812.      IF (FERR(1)) BREAK
  1813.      INC count
  1814.  
  1815.      '
  1816.      '  See if entry is an international entry.  If it is
  1817.      '  and we are processing cp_required = 1 (US) read
  1818.      '  the next line.  If cp_required = 2 (INTL) strip
  1819.      '  the leading "*".
  1820.      '
  1821.      IF (LEFT(hold,1) = "*" && cp_required = 1) CONTINUE
  1822.  
  1823.      '
  1824.      '  If we have checked 100 entries, display to the user so they
  1825.      '  know the program is doing something
  1826.      '
  1827.      IF (!(count % 100)) PRINT CHR(8), CHR(8), CHR(8), CHR(8), SPACE(4-LEN(count)), count
  1828.  
  1829.  
  1830.      '
  1831.      '  Retrieve phone number field from verified log entry
  1832.      '  and check for an already verified number.  If found
  1833.      '  set flag FOUND1 = TRUE
  1834.      '
  1835.      IF (cp_required = 1) THEN
  1836.        hold2 = MID(hold, 1, 12)
  1837.      ELSE IF (cp_required = 2) THEN
  1838.        hold2 = MID(hold, 2, 24)
  1839.      END IF
  1840.  
  1841.      '
  1842.      '  See if phone number in log matches depending on dialing plan
  1843.      '
  1844.      IF (cp_required = 1) THEN
  1845.        IF (hold2 = log_entry) found1 = TRUE
  1846.      ELSE IF (cp_required = 2) THEN
  1847.        IF (RTRIM(hold2," ") = log_entry) found1 = TRUE
  1848.      END IF
  1849.  
  1850.      '
  1851.      '  Found a match if FOUND1 = TRUE
  1852.      '
  1853.      IF (found1) THEN
  1854.  
  1855.        '
  1856.        '  See if username matched
  1857.        '
  1858.        IF (cp_required = 1) THEN
  1859.          start_read = 14
  1860.        ELSE IF (cp_required = 2) THEN
  1861.          start_read = 26
  1862.        END IF
  1863.  
  1864.        IF (MID(hold, start_read, LEN(TRIM(U_NAME()," "))) = TRIM(U_NAME()," ") && RIGHT(MID(hold,start_read,LEN(TRIM(U_NAME()," "))+1), 1) = " ") THEN
  1865.  
  1866.          '
  1867.          '  If up_already_verified is TRUE then the user will be upgraded
  1868.          '  without having to go through the callback process again.  They
  1869.          '  are a previously verified user.
  1870.          '
  1871.          IF (up_already_verified) THEN
  1872.            NEWLINES 3
  1873.            DISPFILE PPEPATH() + "AL-VER", GRAPH+LANG+SEC
  1874.            LOG "** User already Verified - Upgraded Security **", FALSE
  1875.            FPUTLN 7, "**-->> User already verified before"
  1876.            FPUTLN 7, "**-->> Verified entry = ", MID(hold,start_read,LEN(U_NAME()))
  1877.  
  1878.            '
  1879.            '  Set password input to current password
  1880.            '  Set flag for already verified to TRUE
  1881.            '
  1882.            password_input = U_PWD
  1883.            username_input = U_NAME()
  1884.            already_verified = TRUE
  1885.            WAIT
  1886.            FCLOSE 1
  1887.  
  1888.            '
  1889.            '  Set flag TRUE, so users gets a security level increase
  1890.            '
  1891.            do_increase = TRUE
  1892.            BREAK
  1893.            '
  1894.          ELSE
  1895.  
  1896.            '
  1897.            '  Make user do verification again
  1898.            '
  1899.            BREAK
  1900.            '
  1901.          END IF
  1902.        END IF
  1903.  
  1904.        NEWLINES 3
  1905.        '
  1906.        '  Callback number has already been used by another user
  1907.        '  Display file to user informing them of this conflict.
  1908.        '
  1909.        DISPFILE PPEPATH() + "DUPNUM", GRAPH+LANG+SEC
  1910.        LOG "** Duplicate Number - Security Not Changed **", FALSE
  1911.        FPUTLN 7, "~~~~~~Duplicate number found in verified.log~~~~~~ : ", MID(hold,1,12)
  1912.        FPUTLN 7, "     Duplicate entry info: ", hold
  1913.        WAIT
  1914.        GOTO EXIT_PROG
  1915.      END IF
  1916.    END WHILE
  1917.    FCLOSE 1
  1918.    RETURN
  1919.  
  1920. '
  1921. '  Set timeout for local and LD from configuration file and
  1922. '  build number for modem to dial
  1923. '
  1924. :SET_DURATION_BUILD_MODEM_DIAL
  1925.  
  1926.    ' Build sting to send to modem for dialing
  1927.    '
  1928.    ' dialing_string = ATDT/ATDP
  1929.    ' dialing_prefix = additional number to dial out
  1930.    '      ld_prefix = number used to dial a long distance phone number
  1931.    ' intl_ld_prefix = number used to dial an international phone number
  1932.    '
  1933.    IF (cp_required = 1) THEN
  1934.      IF (local_call) THEN
  1935.        '
  1936.        '  If local call which does not require areacode,
  1937.        '  just dial exchange + last 4
  1938.        '
  1939.        IF (INSTR(local_no_area_code, area_code)) THEN
  1940.          send_modem = dialing_string + dialing_prefix + exchange + last_4_nums
  1941.        ELSE
  1942.          '
  1943.          '  else, dial areacode, exchange + last 4 for local call
  1944.          '
  1945.          '
  1946.          send_modem = dialing_string + dialing_prefix + phone_number
  1947.        END IF
  1948.      ELSE
  1949.        IF (intl_callback) THEN
  1950.          '
  1951.          '  cp_required = 1 is always country code "1"
  1952.          '
  1953.          hold2 = intl_ld_prefix + "1"
  1954.        ELSE
  1955.          '
  1956.          '  Long distance call (US to US)
  1957.          '
  1958.          hold2 = ld_prefix
  1959.        END IF
  1960.        '
  1961.        '  Build string
  1962.        '
  1963.        send_modem = dialing_string + dialing_prefix + hold2 + phone_number
  1964.      END IF
  1965.    ELSE IF (cp_required = 2) THEN
  1966.    '
  1967.    '  INTL dialing plan
  1968.    '
  1969.      IF (local_call) THEN
  1970.        '
  1971.        '  Local call = (Ex Code + Last Nums)
  1972.        '
  1973.        send_modem = dialing_string + dialing_prefix + exchange_code + last_nums
  1974.      ELSE
  1975.        '
  1976.        '  LD Call = (LD Prefix + Country Code + Ex Code + Last Nums)
  1977.        '
  1978.        send_modem = dialing_string + dialing_prefix + intl_ld_prefix + phone_number
  1979.      END IF
  1980.    END IF
  1981.  
  1982.    '
  1983.    '  Set duration of each callback depending on local or LD
  1984.    '
  1985.    IF (local_call) THEN
  1986.      duration_to_call = local_time_to_call
  1987.    ELSE
  1988.      duration_to_call = ld_time_to_call
  1989.    END IF
  1990.  
  1991.    '
  1992.    '  See if "suffix" variable has a value.
  1993.    '
  1994.    '  Add to send_modem varualbe if suffix value is not blank.
  1995.    '
  1996.    IF (dialing_suffix != "") THEN
  1997.      IF (suffix_use = "A") THEN
  1998.        send_modem = send_modem + dialing_suffix
  1999.      ELSE IF (suffix_use = "L" && local_call) THEN
  2000.        send_modem = send_modem + dialing_suffix
  2001.      ELSE IF (suffix_use = "D" && !local_call) THEN
  2002.        send_modem = send_modem + dialing_suffix
  2003.      END IF
  2004.    END IF
  2005.  
  2006.    IF (!ONLOCAL()) FPUTLN 7, "  Dialing String to Modem: ", send_modem
  2007.    RETURN
  2008.  
  2009. '
  2010. '  Make callback
  2011. '
  2012. :PERFORM_CALL
  2013.  
  2014.    '
  2015.    '
  2016.    '
  2017.    CDCHKOFF
  2018.    KBDCHKOFF
  2019.    KBDFLUSH
  2020.    MDMFLUSH
  2021.    DTROFF
  2022.    DELAY 18
  2023.  
  2024.    '
  2025.    '  Display on local screen
  2026.    '
  2027.    DISPFILE PPEPATH() + "CALLB", GRAPH+SEC+LANG
  2028.  
  2029.    '
  2030.    '
  2031.    '
  2032.    COLOR @X0F
  2033.    ANSIPOS 19,7
  2034.    IF (local_call) THEN
  2035.      SPRINT "TRUE"
  2036.    ELSE
  2037.      SPRINT "FALSE"
  2038.    END IF
  2039.  
  2040.    '
  2041.    '
  2042.    '
  2043.    ANSIPOS 41,7
  2044.    SPRINT SPACE(3-LEN(duration_to_call)), duration_to_call
  2045.    COLOR @X0F
  2046.    current_timeout_value = 0
  2047.    GOSUB SHOW_TIMEOUT_COUNTDOWN
  2048.  
  2049.    '
  2050.    '
  2051.    '
  2052.    WHILE (cb_remain_number > 0 && !made_connection) DO
  2053.  
  2054.      '
  2055.      '  Drop DTR, Raise DTR
  2056.      '
  2057.      GOSUB MODEM_INIT
  2058.  
  2059.      '
  2060.      '  Check for SysOp interrupt - Carriage Return or Space Bar
  2061.      '
  2062.      '  Carriage Return - Stops the Callback program
  2063.      '  Space Bar       - Recycles the Callback program - Starts another call
  2064.      '
  2065.      GOSUB CHECK_SYSOP_KEY
  2066.      IF (hold = 32 || hold = CHR(32)) CONTINUE
  2067.  
  2068.      '
  2069.      '  Send INIT String to modem
  2070.      '
  2071.      COLOR @X0E
  2072.      ANSIPOS 26,11
  2073.      SPRINT MID("AT" + init_string, 1, 25)
  2074.      ANSIPOS 26,11
  2075.      SENDMODEM "AT" + init_string + CHR(13)
  2076.      DELAY 18
  2077.  
  2078.      '
  2079.      '  Display information on LOCAL screen
  2080.      '
  2081.      COLOR @X8D
  2082.      ANSIPOS 26,12
  2083.      SPRINT cb_remain_number, SPACE(3-LEN(cb_remain_number))
  2084.      FPUTLN 7, "         Callback Attempt: Started @ ", STRING(TIME())
  2085.  
  2086.      '
  2087.      '  Set starting time for callback timeout watch
  2088.      '
  2089.      start_time = TIME()
  2090.  
  2091.      '
  2092.      '  Dial the modem - show number called on CALLB display
  2093.      '
  2094.      modem_string = ""
  2095.      COLOR @X03
  2096.      ANSIPOS 26,13
  2097.      SPRINT log_entry                ' displays phone number with HYPHENS
  2098.      SENDMODEM send_modem + CHR(13)
  2099.  
  2100.      '
  2101.      '  Display 'Waiting' in Modem return field
  2102.      '
  2103.      ANSIPOS 26,14
  2104.      COLOR @X02
  2105.      SPRINT "Waiting..."
  2106.      ANSIPOS 26,14
  2107.  
  2108.      '
  2109.      '  Loop to monitor modem results (ring, busy, connect, no dialtone)
  2110.      '
  2111.      WHILE (1) DO
  2112.  
  2113.        end_time = TIME()
  2114.        '
  2115.        '  Check to see if the timeout value has been exceeded
  2116.        '
  2117.        IF (end_time > (start_time + duration_to_call)) THEN
  2118.          DEC cb_remain_number
  2119.          '
  2120.          '  Clear the display fields for next call
  2121.          '
  2122.          GOSUB CLEAR_CALLB
  2123.          current_timeout_value = 0
  2124.          GOSUB SHOW_TIMEOUT_COUNTDOWN
  2125.          FPUTLN 7, "            Modem results: **-->> Callback Timeout...."
  2126.          BREAK
  2127.        ELSE
  2128.          GOSUB SHOW_TIMEOUT_COUNTDOWN
  2129.        END IF
  2130.  
  2131.        '
  2132.        '  Check for SysOp interrupt - Carriage Return or Space Bar
  2133.        '
  2134.        '  Carriage Return - Stops the Callback program
  2135.        '  Space Bar       - Recycles the Callback program - Starts another call
  2136.        '
  2137.        GOSUB CHECK_SYSOP_KEY
  2138.        IF (hold = 32 || hold = CHR(32)) BREAK
  2139.  
  2140.        '
  2141.        '  Gather bytes from modem to determine matching string
  2142.        '  Make sure we do not gather Carriage Returns or Line Feeds
  2143.        '
  2144.        modem_byte = MGETBYTE()
  2145.        DELAY 2
  2146.        '
  2147.        '  -1 is returned when there is no byte to get from Modem
  2148.        '
  2149.        IF (modem_byte != -1) THEN
  2150.  
  2151.          '
  2152.          '  If not a CR or LF, add the character to the modem_string variable
  2153.          '
  2154.          IF (modem_byte != 10 && modem_byte != 13) modem_string = modem_string + CHR(modem_byte)
  2155.  
  2156.          '
  2157.          ' See if we have a CONNECT message from modem
  2158.          '
  2159.          IF (INSTR(modem_string, "CONNECT")) THEN
  2160.            modem_string = modem_string + CHR(MGETBYTE())
  2161.  
  2162.            '
  2163.            '  Get actual connect rate and ARQ to display to SysOp
  2164.            '
  2165.            WHILE (1) DO
  2166.              modem_byte = MGETBYTE()
  2167.              IF (modem_byte = -1) BREAK
  2168.              modem_string = modem_string + CHR(modem_byte)
  2169.            END WHILE
  2170.  
  2171.            '
  2172.            '  Display connect message on local screen
  2173.            '
  2174.            COLOR @X0F
  2175.            ANSIPOS 26,14
  2176.            IF (LEN(modem_string) > 45) modem_string = MID(modem_string, 1, 45)
  2177.            SPRINT modem_string
  2178.            ANSIPOS 26,14
  2179.            made_connection = TRUE
  2180.            BREAK
  2181.  
  2182.            '
  2183.            ' See if we have a BUSY message from modem
  2184.            '
  2185.          ELSE IF (INSTR(modem_string, "BUSY")) THEN
  2186.  
  2187.            '
  2188.            ' Display Modem message
  2189.            '
  2190.            COLOR @X0F
  2191.            ANSIPOS 26,14
  2192.            SPRINT modem_string + SPACE(20-LEN(modem_string))
  2193.            ANSIPOS 26,14
  2194.            SENDMODEM "ATH0" + CHR(13)
  2195.            DELAY 18
  2196.            current_timeout_value = 0
  2197.            GOSUB SHOW_TIMEOUT_COUNTDOWN
  2198.            GOSUB CLEAR_CALLB
  2199.            FPUTLN 7, "            Modem results: Busy...let's try again"
  2200.            COLOR @X07
  2201.            cb_remain_number = cb_remain_number - busy_value
  2202.            BREAK
  2203.  
  2204.            '
  2205.            '  See if we have NO DIALtone from Modem
  2206.            '
  2207.          ELSE IF (INSTR(modem_string, "NO DIAL")) THEN
  2208.  
  2209.            '
  2210.            ' Display Modem message
  2211.            '
  2212.            COLOR @X0F
  2213.            ANSIPOS 26,14
  2214.            SPRINT modem_string + SPACE(20-LEN(modem_string))
  2215.            ANSIPOS 26,14
  2216.            DELAY 18
  2217.            current_timeout_value = 0
  2218.            GOSUB SHOW_TIMEOUT_COUNTDOWN
  2219.            GOSUB CLEAR_CALLB
  2220.            COLOR @X0C
  2221.            FPUTLN 7, "            Modem results: No Dialtone...let's try again"
  2222.            COLOR @X07
  2223.            cb_remain_number = cb_remain_number - no_dial_value
  2224.            BREAK
  2225.  
  2226.            '
  2227.            '  See if we have an INCOMING call from Modem
  2228.            '
  2229.          ELSE IF (INSTR(modem_string, "RING")) THEN
  2230.  
  2231.            '
  2232.            ' Display Modem message
  2233.            '
  2234.            COLOR @X0F
  2235.            ANSIPOS 26,14
  2236.            SPRINT modem_string + SPACE(20-LEN(modem_string))
  2237.            ANSIPOS 26,14
  2238.            COLOR @X8C
  2239.            ANSIPOS 3,18
  2240.            SPRINT "***** "
  2241.            COLOR @X0F
  2242.            SPRINT "INCOMING CALL - TERMINATE!!! "
  2243.            COLOR @X8C
  2244.            SPRINT "*****"
  2245.  
  2246.            '
  2247.            '  Pick up the call, then drop DTR to hang up
  2248.            '
  2249.            COLOR @X0A
  2250.            ANSIPOS 3,18
  2251.            SPRINT "Pick up phone, "
  2252.            COLOR @X0F
  2253.            SPRINT "drop DTR <G>, "
  2254.            COLOR @X0A
  2255.            SPRINT "bye bye incoming..."
  2256.            ANSIPOS 3,18
  2257.            SENDMODEM "ATH1" + CHR(13)
  2258.            DELAY 54
  2259.            current_timeout_value = 0
  2260.            GOSUB SHOW_TIMEOUT_COUNTDOWN
  2261.            '
  2262.            '  Clear screen display fields
  2263.            '
  2264.            GOSUB CLEAR_CALLB
  2265.  
  2266.            '
  2267.            '  Drop DTR, raise DTR
  2268.            '
  2269.            GOSUB MODEM_INIT
  2270.            FPUTLN 7, "            Modem results: Incoming Call...let's try again"
  2271.            cb_remain_number = cb_remain_number - ring_value
  2272.  
  2273.            '
  2274.            '  Break out of Modem pooling loop to start
  2275.            '  another callback due to a non-connect
  2276.            '
  2277.            BREAK
  2278.  
  2279.          END IF
  2280.        END IF
  2281.      END WHILE
  2282.      '
  2283.      '  Clear the display fields for next call
  2284.      '
  2285.      current_timeout_value = 0
  2286.      GOSUB SHOW_TIMEOUT_COUNTDOWN
  2287.      IF (INSTR(modem_string, "CONNECT") = 0) GOSUB CLEAR_CALLB
  2288.      CONTINUE
  2289.    END WHILE
  2290.    RETURN
  2291.  
  2292. '
  2293. '  Stop checking for carrier, and Keyboard
  2294. '  Flush modem and Keyboard Buffers
  2295. '  Drop DTR, Raise DTR, send modem init commands
  2296. '
  2297. :MODEM_INIT
  2298.  
  2299.      CDCHKOFF
  2300.      KBDCHKOFF
  2301.      KBDFLUSH
  2302.      MDMFLUSH
  2303.      DTROFF
  2304.      ANSIPOS 26,9
  2305.      COLOR @X0C
  2306.      SPRINT "Active          "
  2307.      ANSIPOS 26,9
  2308.      DELAY 72
  2309.      COLOR @X0F
  2310.      SPRINT "Done            "
  2311.      ANSIPOS 26,10
  2312.      DTRON
  2313.      COLOR @X0C
  2314.      SPRINT "Active          "
  2315.      ANSIPOS 26,10
  2316.      DELAY 9
  2317.      COLOR @X0F
  2318.      SPRINT "Done            "
  2319.      RETURN
  2320.  
  2321. '
  2322. '  Ask the user for their Password as verification
  2323. '
  2324. :ASK_VERIFY_VERIFICATION_INFO
  2325.  
  2326.    '
  2327.    '  Initialize variables and clear the screen
  2328.    '
  2329.    password_input = ""
  2330.    username_input = ""
  2331.    do_increase = FALSE
  2332.    int_count = 1
  2333.    CLS
  2334.  
  2335.    '
  2336.    '  Display proper screen depending on verification_type
  2337.    '
  2338.    IF (verification_type = "BOTH") DISPFILE PPEPATH() + "getpwun", LANG+GRAPH+SEC
  2339.    IF (verification_type = "USER") DISPFILE PPEPATH() + "getun", LANG+GRAPH+SEC
  2340.    IF (verification_type = "PASS") DISPFILE PPEPATH() + "getpw", LANG+GRAPH+SEC
  2341.  
  2342.    '
  2343.    '  Clear out any waiting characters, and ask for username/password
  2344.    '
  2345.    KBDFLUSH
  2346.    MDMFLUSH
  2347.  
  2348.    '
  2349.    ' Ask for username verification
  2350.    '
  2351.    IF (verification_type = "BOTH" || verification_type = "USER") THEN
  2352.      '
  2353.      WHILE (!username_correct) DO
  2354.        '
  2355.        '  Check to see if user has exceeded allowed verification attempts
  2356.        '
  2357.        IF (int_count > verification_entry_count) GOTO EXCEED_TRIES
  2358.        '
  2359.        '  Prompt user for their username they logged on with
  2360.        '
  2361.        main_prompt = "   Enter Username"
  2362.        INPUTSTR main_prompt, username_input, @X0E, 25, MASK_ASCII(), UPCASE+FIELDLEN+LFAFTER
  2363.        '
  2364.        '  If username is  wrong, inform user and show how many attempts are
  2365.        '  remaining to enter correct username
  2366.        '
  2367.        IF (username_input <> U_NAME()) THEN
  2368.           PRINT " @X0CIncorrect Username@X0F!!!...@X0BPlease try again. @X0C[@X0E"
  2369.           PRINTLN verification_entry_count - int_count, "@X0C] @X0Btries remaining"
  2370.           FPUTLN 7, "       Incorrect Username: " + username_input
  2371.           INC int_count
  2372.           username_input = ""
  2373.           DELAY 18
  2374.        ELSE
  2375.          username_correct = TRUE
  2376.          IF (verification_type != "BOTH") THEN
  2377.            do_increase = TRUE
  2378.            BREAK
  2379.          END IF
  2380.        END IF
  2381.      END WHILE
  2382.    END IF
  2383.  
  2384.    '
  2385.    ' Ask for Password verification
  2386.    '
  2387.    IF (verification_type = "BOTH" || verification_type = "PASS") THEN
  2388.      WHILE (!password_correct) DO
  2389.        '
  2390.        '  Check to see if user has exceeded allowed verification attempts
  2391.        '
  2392.        IF (int_count > verification_entry_count) GOTO EXCEED_TRIES
  2393.        '
  2394.        '  Prompt user for their password they logged on with
  2395.        '
  2396.        main_prompt = "   Enter Password"
  2397.        INPUTSTR main_prompt, password_input, @X0E, 12, MASK_ASCII(), UPCASE+ECHODOTS+FIELDLEN+LFAFTER
  2398.        '
  2399.        '  If password is wrong, inform user and show how many attempts are
  2400.        '  remaining to enter correct password
  2401.        '
  2402.        IF (password_input <> U_PWD) THEN
  2403.           PRINT " @X0CIncorrect Password@X0F!!!...@X0BPlease try again. @X0C[@X0E"
  2404.           PRINTLN verification_entry_count - int_count, "@X0C] @X0Btries remaining"
  2405.           FPUTLN 7, "       Incorrect Password: " + password_input
  2406.           INC int_count
  2407.           password_input = ""
  2408.           DELAY 18
  2409.        ELSE
  2410.          password_correct = TRUE
  2411.          do_increase = TRUE
  2412.          BREAK
  2413.        END IF
  2414.      END WHILE
  2415.    END IF
  2416.    RETURN
  2417.  
  2418.    '
  2419.    '  User exceeded their verification information attempts.
  2420.    '  Disconnect the user from the BBS and log it
  2421.    '
  2422. :EXCEED_TRIES
  2423.  
  2424.    NEWLINE
  2425.    DISPFILE PPEPATH() + "FAL-SEC", GRAPH+LANG+SEC
  2426.    FPUTLN 7, "**-->> Excessive Verification Attempts - Disconnecting User"
  2427.    LOG "** Excessive Verification Attempts - Security Level Not Changed **", FALSE
  2428.  
  2429.    '
  2430.    '  Update users security to "FAILED" security level
  2431.    '
  2432.    U_SEC = failure_level
  2433.    FPUTLN 7, "    Security Level set to: " + STRING(failure_level)
  2434.    PUTUSER
  2435.    DELAY 54
  2436.  
  2437.    '
  2438.    '  Close Log file
  2439.    '
  2440.    GOSUB CLOSE_LOG
  2441.  
  2442.    IF (!ONLOCAL()) THEN
  2443.      HANGUP
  2444.    ELSE
  2445.      PRINTLN "Local Testing - User stays online"
  2446.      FPUTLN 7, "Local Testing - User stays online"
  2447.    END IF
  2448.  
  2449.    END        ' Not needed but have it here for end of subroutine marker
  2450.  
  2451. '
  2452. '    User entered correct username/password so tell'm whats up and add
  2453. '    their phone number to vierified file, raise their security level and
  2454. '    add days to their date expiration (if configured).
  2455. '
  2456. :INCREASE_LEVEL
  2457.  
  2458.    IF (do_increase) THEN
  2459.      '
  2460.      IF (U_SEC < verified_level || ONLOCAL()) THEN
  2461.  
  2462.        '
  2463.        '  Set the users security level to the VERIFIED SECURITY LEVEL
  2464.        '
  2465.        U_SEC = verified_level
  2466.  
  2467.        '
  2468.        '  Set the users expired security level
  2469.        '
  2470.        U_EXPSEC = expired_level
  2471.  
  2472.        '
  2473.        '  Set the users expiration date (if .CFG entry is not a blank line)
  2474.        '
  2475.        IF (expired_date_days != 0) THEN
  2476.          U_EXPDATE = DATE() + expired_date_days
  2477.        ELSE
  2478.          U_EXPDATE = 0
  2479.        END IF
  2480.  
  2481.        '
  2482.        '  Check to see if
  2483.        '
  2484.        IF (post_cbinfo_user_record != "") GOSUB POST_COMMENT_NOTES
  2485.  
  2486.        '
  2487.        '  Write new information to users record, and inform user
  2488.        '  of a successful callback.
  2489.        '
  2490.        PUTUSER
  2491.  
  2492.        '
  2493.        '  Adjust (add/subtract) users time based on security level entry
  2494.        '
  2495.        ADJTIME adjust_mins
  2496.  
  2497.        '
  2498.        '  Import message into Message base
  2499.        '
  2500.        IF (msg_text_file != "") MESSAGE msg_conf_num, "SYSOP", "CB-FREE Callback PPE", MIXED(U_NAME()) + " - Completed Callback", "R", 0, FALSE, FALSE, msg_text_file
  2501.  
  2502.        '
  2503.        '  Clear the screen and inform user of their security level upgrade
  2504.        '
  2505.        CLS
  2506.        '
  2507.        '  Display file to user informing them that a callback will
  2508.        '  not be required as their CID information matches the
  2509.        '  number in their user record.  This file will display only
  2510.        '  if it exists
  2511.        '
  2512.        IF (cid_matches_user && EXIST(PPEPATH() + "CID-USR")) DISPFILE PPEPATH() + "CID-USR", GRAPH+LANG+SEC
  2513.  
  2514.        '
  2515.        '  If the file PAS-SEC exists, display it after showing user their
  2516.        '  security level has been upgraded. (Passed Callback Security Level)
  2517.        '
  2518.        NEWLINE
  2519.        IF (EXIST(PPEPATH() + "PAS-SEC")) DISPFILE PPEPATH() + "PAS-SEC", GRAPH+LANG+SEC
  2520.  
  2521.        '
  2522.        '  If the user is not already verified, add them to the VERIFIED.LOG
  2523.        '
  2524.        IF (!already_verified) THEN
  2525.          '
  2526.          '  Loop incase VERIFIED.LOG is being used by another node.  If
  2527.          '  the file is in use, we will pause approx. 1 second and try again
  2528.          '  up to 10 times.
  2529.          '
  2530.          FOR int_count = 1 TO 10
  2531.            '
  2532.            '  Add the verified number to the VERIFIED.LOG file
  2533.            '
  2534.            FAPPEND 1,PPEPATH() + "VERIFIED.LOG", O_WR, S_DW
  2535.  
  2536.            '
  2537.            '  If we get an error trying to open VERFIFIED.LOG for write
  2538.            '  access, there is probably another node writing to the
  2539.            '  file.  So, we will delay approximately 1 second and try
  2540.            '  again.
  2541.            '
  2542.            IF (FERR(1)) THEN
  2543.              COLOR @X0F
  2544.              NEWLINE
  2545.              SPRINTLN "Error opening VERIFIED.LOG - Pause 1 Sec and try again"
  2546.              FPUTLN 7, "**-->> Error opening VERIFIED.LOG - Pause 1 Sec - try again"
  2547.              COLOR @X07
  2548.              DELAY 18
  2549.              CONTINUE
  2550.            END IF
  2551.  
  2552.            '
  2553.            '  Right fill non "US" calling plan phone number with spaces
  2554.            '  so each entry is 25 characters in length and starts with
  2555.            '  an "*"
  2556.            '
  2557.            IF (cp_required = 2) log_entry = "*" + log_entry + SPACE(23-(LEN(log_entry)))
  2558.  
  2559.            '
  2560.            '  Build entry to write to VERIFIED.LOG.
  2561.            '
  2562.            hold = log_entry + " " + U_NAME() + " " + STRING(TIME()) + " " + STRING(DATE())
  2563.  
  2564.            '
  2565.            '  Append LOCAL, LONG DISTANCE, or INTERNATIONAL to entry
  2566.            '
  2567.            IF (intl_callback) THEN
  2568.              hold = hold + "International"
  2569.            ELSE
  2570.              IF (local_call) THEN
  2571.                hold = hold + " Local"
  2572.              ELSE
  2573.                hold = hold + " Long Distance"
  2574.              END IF
  2575.            END IF
  2576.  
  2577.            '
  2578.            '  See if Caller ID in use, and we got a Caller ID Phone number
  2579.            '  If so, append it to the string posted to VERIFIED.LOG
  2580.            '
  2581.            IF (caller_id_info != "" && process_caller_id) hold = hold + " - CID # Used"
  2582.  
  2583.            '
  2584.            '  Write the information to the log
  2585.            '
  2586.            FPUTLN 1, hold
  2587.  
  2588.            '
  2589.            '  Check to see if Data or Voice phone number was used.
  2590.            '
  2591.            log_entry = STRIPSTR(log_entry, "-")
  2592.            IF (log_entry != h_phone_number) GOSUB ADD_VOICE_TO_LOG
  2593.            IF ((log_entry != d_phone_number) && (d_phone_number != h_phone_number)) GOSUB ADD_DATA_TO_LOG
  2594.  
  2595.            '
  2596.            '  Close VERIFIED.LOG
  2597.            '
  2598.            FCLOSE 1
  2599.  
  2600.            '
  2601.            '  Exit the FOR loop
  2602.            '
  2603.            BREAK
  2604.            '
  2605.          NEXT
  2606.          '
  2607.        END IF
  2608.  
  2609.        '
  2610.        '  Determine what to print to NODE?.LOG file
  2611.        '
  2612.        IF (!already_verified) THEN
  2613.          IF (verification_type = "BOTH") THEN
  2614.            FPUTLN 7, "Matching Username/Password entered, Raise Security Level to " + STRING(verified_level)
  2615.          ELSE IF (verification_type = "PASS") THEN
  2616.            FPUTLN 7, "Matching Password entered, Raise Security Level to " + STRING(verified_level)
  2617.          ELSE IF (verification_type = "USER") THEN
  2618.            FPUTLN 7, "Matching Username entered, Raise Security Level to " + STRING(verified_level)
  2619.          END IF
  2620.        ELSE
  2621.          FPUTLN 7, "Already Verified, Raise Security Level to " + STRING(verified_level)
  2622.        END IF
  2623.  
  2624.        '
  2625.        '  Write to PCB Callers File that users security was upgraded
  2626.        '
  2627.        LOG "%%% Users Security Upgraded %%%", FALSE
  2628.      ELSE
  2629.  
  2630.        '
  2631.        '  If users security level is GREATER THAN OR EQUAL TO the security
  2632.        '  file upgrade security level, inform the user there was no change
  2633.        '  made.
  2634.        '
  2635.        CLS
  2636.        NEWLINES 6
  2637.        PRINTLN "@X0ACallback completed@X0F....@X0ESecurity Level too High@X0F...@X0CSecurity not adjusted@X07"
  2638.        FPUTLN 7, "**-->> Security Level not changed.  Current Security Level too High"
  2639.        '
  2640.      END IF
  2641.    END IF
  2642.  
  2643.    '
  2644.    '  User was long distance so boot'em out of here to keep the
  2645.    '  LD charges from adding up any more.
  2646.    '
  2647.    IF (!local_call && !already_verified && drop_ld_cb) THEN
  2648.      NEWLINE
  2649.      PRINTLN "@X0CLong Distance Callback.   .......@X0EDisconnecting now......"
  2650.      PRINTLN "@X0FPlease call us right back to enjoy your increased access@X07"
  2651.      FPUTLN 7, "Long Distance Call....Hanging up the phone"
  2652.      LOG "** Long Distance - Disconnecting now... **", FALSE
  2653.      DELAY 54
  2654.      GOTO EXIT_PROG
  2655.    END IF
  2656.  
  2657.    '
  2658.    ' Make sure we log information telling the SysOp the user is
  2659.    ' a long distance callback, but they are allowed to remain online
  2660.    '
  2661.    ' This is due to a configuration setting (#26) allowing this
  2662.    '
  2663.    IF (!local_call && !already_verified && !drop_ld_cb) THEN
  2664.      FPUTLN 7, "Long Distance Callback.............User REMAINS online!"
  2665.      FPUTLN 7, "Configuration Setting #26 (FALSE) allows this to occur!"
  2666.      LOG "** Long Distance Callback - User REMAINS online!! **", FALSE
  2667.    END IF
  2668.  
  2669.    '
  2670.    ' local_call set to TRUE so HANGUP command does not
  2671.    ' get invoked in EXIT_PROG
  2672.    '
  2673.    local_call = TRUE
  2674.  
  2675.    RETURN
  2676.  
  2677. '
  2678. '  Prompt user to continue or go back to BBS
  2679. '
  2680. :BEGIN_CALLBACK
  2681.  
  2682.    NEWLINE
  2683.    user_input = ""
  2684.  
  2685.    '
  2686.    '  If configuration not set to process caller ID, or
  2687.    '  the callerid string returns no information show
  2688.    '  the user their "user record" phone numbers and ask
  2689.    '  them to choose one for callback
  2690.    '
  2691.    IF (process_caller_id && cp_required = 1) GOSUB PROCESS_CALLER_ID_INFO
  2692.  
  2693.    '
  2694.    '  Log User Security level, and Phone Number information.
  2695.    '
  2696.    FPUTLN 7, "    User's Security Level: ", U_SEC
  2697.    FPUTLN 7, " RAW User Rec. Data Phone: ", U_BDPHONE
  2698.    FPUTLN 7, " RAW User Rec. Home Phone: ", U_HVPHONE
  2699.  
  2700.    '
  2701.    '  Start loop to GET and PROCESS users phone number
  2702.    '
  2703.    WHILE (1) DO
  2704.  
  2705.      '
  2706.      '  Check to see if user record info for voice and
  2707.      '  data phone numbers has a value other than nothing or spaces
  2708.      '
  2709.      user_record_phone = FALSE
  2710.  
  2711.      '
  2712.      ' Check to see if user is "Re-Entering" their phone number.  If so
  2713.      ' skip the user record choices and prompt for their phone number.
  2714.      ' The prompting for a phone number will only occur if:
  2715.      '
  2716.      '  1.  Bad phone number in user record
  2717.      '  2.  SysOp has the "Other Phone Number" option turned on
  2718.      '
  2719.      IF (user_input != "R") THEN
  2720.  
  2721.        '
  2722.        '  Check to see if user record phone numbers are available
  2723.        '
  2724.        IF (U_BDPHONE != "" || U_HVPHONE != "" || U_BDPHONE != SPACE(LEN(U_BDPHONE)) || U_HVPHONE != SPACE(LEN(U_HVPHONE))) THEN
  2725.  
  2726.          '
  2727.          '  If no callerid info, or not processing callerid, or using INTL
  2728.          '  calling plan, get phone numbers from user record
  2729.          '
  2730.          IF (caller_id_info = "" || !process_caller_id || cp_required != 1) THEN
  2731.  
  2732.            '
  2733.            '  If caller_id_info is blank -OR- we are not processing
  2734.            '  caller ID information, get phone numbers from user record
  2735.            '  and prompt the user as to which one they want to use for
  2736.            '  callback.  CID only for US call plan.
  2737.            '
  2738.            GOSUB PROCESS_USER_RECORD_PHONE
  2739.            '
  2740.          ELSE
  2741.  
  2742.            '
  2743.            '  Retrieve and "clean" data and voice user record phone numbers
  2744.            '
  2745.            GOSUB PREPARE_DATA_VOICE_NUMBERS
  2746.  
  2747.            '
  2748.            '  strip all unwanted "telephone" characters from CID string
  2749.            '  (there shouldn't be any, but in case some modems do this)
  2750.            '
  2751.            hold = caller_id_info
  2752.            GOSUB CLEAN_UP_NUMBER
  2753.  
  2754.            '
  2755.            '  Log our "processed" CID string
  2756.            '
  2757.            FPUTLN 7, "    Caller ID information: ", hold
  2758.  
  2759.            '
  2760.            '  Put "clean" telephone information back in caller ID variable
  2761.            '
  2762.            caller_id_info = hold
  2763.  
  2764.            '
  2765.            '  Prepare area code, exchange, and last 4 nums (from CID info)
  2766.            '
  2767.            area_code = MID(hold, 1, 3)
  2768.            exchange = MID(hold, 4, 3)
  2769.            last_4_nums = MID(hold, 7, 4)
  2770.            log_entry = area_code + "-" + exchange + "-" + last_4_nums
  2771.  
  2772.            '
  2773.            '  Set to true to bypass asking for "Other" phone number
  2774.            '  since neither the Home or Data phone number was chosen
  2775.            '  due to caller id being used
  2776.            '
  2777.            user_record_phone = TRUE
  2778.  
  2779.            '
  2780.            '  Log which phone number we are using (data, voice, CID)
  2781.            '
  2782.            FPUTLN 7, "        Phone number used: Caller ID"
  2783.            '
  2784.          END IF             ' end of IF (CALLID()...
  2785.        END IF               ' end of processing USER RECORD phone numbers
  2786.      END IF                 ' end of checking for Re-Enter
  2787.  
  2788.      '
  2789.      '  Get "O"ther phone number and process *OR* process the phone
  2790.      '  number chosen from their USER RECORD.  This routine checks
  2791.      '  the areacode, exchange, and last 4 numbers against numbers
  2792.      '  in the TRASHCAN.DAT file
  2793.      '
  2794.      GOSUB GET_PROCESS_PHONE_NUMBER
  2795.  
  2796.      '
  2797.      '  If user has CID, and CIDNFO file exists, it will
  2798.      '  be displayed to the user.  This file can be used
  2799.      '  to inform Caller ID users, to just hit "C" for
  2800.      '  continue, and the callback process will upgrade
  2801.      '  them automatically (if configured to auto-upgrade
  2802.      '  in .CFG entry #19), without having to perform an
  2803.      '  acutal callback.
  2804.      '
  2805.      IF (EXIST(PPEPATH() + "CIDNFO") && caller_id_info != "" && process_caller_id && upgrade_caller_id) DISPFILE PPEPATH() + "CIDNFO", GRAPH+SEC+LANG
  2806.  
  2807.      '
  2808.      '  Show user what number will be used and ask them
  2809.      '  to: Continue, Re-enter, Exit the callback
  2810.      '
  2811.      NEWLINE
  2812.      user_input = "C"
  2813.      PRINTLN "@X0BPhone number used for Callback: @X1F", log_entry, "@X07"
  2814.      NEWLINE
  2815.  
  2816.      '
  2817.      '  If Caller-Id is being Used, Do not allow user to "Re-Enter"
  2818.      '  their phone number.  Only allow them to Continue or Exit.
  2819.      '
  2820.      IF ((caller_id_info != "" && process_caller_id) || user_record_phone) THEN
  2821.        main_prompt = "@X0EC@X0F)@X02ontinue callback process, @X0EE@X0F)@X02xit Callback@X0F"
  2822.        INPUTSTR main_prompt, user_input, @X0B, 1, "CE", UPCASE+FIELDLEN+GUIDE+LFAFTER
  2823.      ELSE
  2824.        main_prompt = "@X0ER@X0F)@X02e-Enter Phone Number or @X0EC@X0F)@X02ontinue callback process, @X0EE@X0F)@X02xit Callback@X0F"
  2825.        INPUTSTR main_prompt, user_input, @X0B, 1, "CER", UPCASE+FIELDLEN+GUIDE+LFAFTER
  2826.      END IF
  2827.  
  2828.      '
  2829.      '  See what the user entered
  2830.      '
  2831.      SELECT CASE (user_input)
  2832.  
  2833.        '
  2834.        '  User choose to EXIT callback
  2835.        '
  2836.        CASE "E"
  2837.          FPUTLN 7, "**-->> User aborted callback"
  2838.          local_call = TRUE
  2839.          GOTO EXIT_PROG
  2840.  
  2841.        '
  2842.        '  User choose to RE-ENTER phone number
  2843.        '
  2844.        CASE "R"
  2845.          FPUTLN 7, "####  User choose to RE-ENTER their phone number"
  2846.          IF (improper_user_rec_phone) user_input = ""
  2847.          CONTINUE
  2848.  
  2849.        '
  2850.        '  Continue with callback
  2851.        '
  2852.        DEFAULT
  2853.          BREAK
  2854.  
  2855.      END SELECT
  2856.      IF (user_input = "C") BREAK
  2857.    END WHILE
  2858.    NEWLINE
  2859.    RETURN
  2860.  
  2861. '
  2862. '  Retrieve CID information
  2863. '
  2864. :PROCESS_CALLER_ID_INFO
  2865.  
  2866.    '
  2867.    '  Retrieve the caller id information
  2868.    '  Sample Caller ID information string:
  2869.    '
  2870.    '  caller_id_info = "CID: DATE = 0111 TIME = 0015 NMBR = 3019464444"
  2871.    '
  2872.    '  Some Phone Co. allow the user to have their NUMBER blocked when
  2873.    '  calling out.  If so the number will come in as PRIVATE (see below)
  2874.    '  or possibly BLOCKED.  Check with local phone co.
  2875.    '
  2876.    'caller_id_info = "CID: DATE = 0111 TIME = 0015 NMBR = 3019464372"
  2877.    'caller_id_info = "3019464372 NAME=DAN_SHORE"
  2878.  
  2879.    '
  2880.    '  Retrieve CID info
  2881.    '
  2882.    caller_id_info = TRIM(UPPER(CALLID())," ")
  2883.  
  2884.    '
  2885.    '  Log RAW (not parsed yet) CID information being passed to PCB
  2886.    '
  2887.    FPUTLN 7, "      RAW CID information: ", caller_id_info
  2888.  
  2889.    '
  2890.    '  See if the variable "block_cid_string" is part of the CID string, and
  2891.    '  also check to see if SysOp wants to stop users who block CID info.
  2892.    '  If sysop is stopping any user who blocks CID info, then show
  2893.    '  the file NOBLOCK and exit from the PPE.
  2894.    '
  2895.    '  NOTE:  Some local phone companies allow you to stop any calls
  2896.    '         where a user is blocking caller id.  This is stopped at
  2897.    '         the central office and never reaches your BBS.  The user
  2898.    '         will receive a recording informing them of the inability
  2899.    '         to call the desired number with CID blocked.  Again,
  2900.    '         check with your local phone company for this option.
  2901.    '
  2902.    IF (INSTR(caller_id_info, blocked_cid_string) && stop_blocked_cid_caller) THEN
  2903.      DISPFILE PPEPATH() + "NOBLOCK", GRAPH+LANG+SEC
  2904.      FPUTLN 7, "**-->>   Blocked CID Info: User has CID Blocked - Exiting PPE"
  2905.      DELAY 36
  2906.      '
  2907.      '  Make sure we do not disconnect user
  2908.      '
  2909.      local_call = TRUE
  2910.      GOTO EXIT_PROG
  2911.    END IF
  2912.  
  2913.    '
  2914.    '  See if cid_string_to_search is part of the CID string
  2915.    '
  2916.    '  Find character position in string
  2917.    '
  2918.    hold = caller_id_info
  2919.    IF (cid_string_to_search = "") THEN
  2920.      int_count = 999
  2921.    ELSE
  2922.      int_count = INSTR(hold, cid_string_to_search)
  2923.    END IF
  2924.  
  2925.    IF (int_count) THEN
  2926.  
  2927.      '
  2928.      '  No string to search for, just the number
  2929.      '
  2930.      IF (int_count = 999) int_count = 1
  2931.  
  2932.      '
  2933.      '  Add length of number string to bypass string
  2934.      '
  2935.      '  "NMBR =" (6 characters long)  int_count = int_count + 6
  2936.      '
  2937.      int_count = int_count + LEN(cid_string_to_search)
  2938.  
  2939.      '
  2940.      '  Get the phone number and trim spaces from both ends
  2941.      '
  2942.      hold = TRIM(MID(hold, int_count, LEN(hold) - (int_count-1))," ")
  2943.  
  2944.      '
  2945.      '  Make sure we are only getting the phone number.  Some CID
  2946.      '  strings have a name field after the phone number
  2947.      '
  2948.      IF (INSTR(hold, " ") != 0) hold = MID(hold, 1, INSTR(hold, " ")-1)
  2949.  
  2950.      '
  2951.      '  Check to see if we have a phone number in the field.  Sometimes
  2952.      '  a number will be "OUTOFAREA" and we do not want to use this as
  2953.      '  a callback number.
  2954.      '
  2955.      temp_real = TOREAL(hold)
  2956.      IF (temp_real > 0) THEN
  2957.        '
  2958.        '  See if the Phone number is in hex.  If so convert it to
  2959.        '  an ASCII phone number.
  2960.        '
  2961.        IF (cid_use_hex) GOSUB CONVERT_HEX
  2962.        '
  2963.      ELSE
  2964.        '
  2965.        '  No Phone number in CID field, so set to '0'
  2966.        '
  2967.        hold = "0"
  2968.        '
  2969.      END IF
  2970.  
  2971.      '
  2972.      '  If no caller Id info (0), set it to blank
  2973.      '
  2974.      IF (hold = "0") THEN
  2975.        caller_id_info = ""
  2976.      ELSE
  2977.  
  2978.        '
  2979.        '  Put CID information into CID variable
  2980.        '
  2981.        caller_id_info = hold
  2982.  
  2983.        '
  2984.        '  If the CID information only has 7 digits (exchange and last 4)
  2985.        '  add the areacode found in configuration file to the beginning
  2986.        '
  2987.        IF (LEN(caller_id_info) = 7) caller_id_info = add_ac_to_cid + caller_id_info
  2988.        '
  2989.      END IF
  2990.      '
  2991.    ELSE
  2992.  
  2993.        '
  2994.        '  If cid_string_to_search is not found, assume there is no
  2995.        '  caller id information to process.
  2996.        '
  2997.        caller_id_info = ""
  2998.        '
  2999.    END IF
  3000.    RETURN
  3001.  
  3002. '
  3003. '  Convert the HEX phone number string to an ASCII phone number.
  3004. '
  3005. '  Code and information on HEX used WITH PERMISSION by Gary Meeker
  3006. '
  3007. '  This code was originally from Gary's CIDPPE program.  Thanks!
  3008. '
  3009. :CONVERT_HEX
  3010.  
  3011.    '
  3012.    '  Initialize variables
  3013.    '
  3014.    count = 3
  3015.    hold2 = ""
  3016.  
  3017.    '
  3018.    '  Find length of HEX number
  3019.    '
  3020.    inp_length = S2I(MID(hold, count, 2), 16)
  3021.  
  3022.    '
  3023.    '  Process until the entire "length" is read
  3024.    '
  3025.    WHILE (inp_length > 0) DO
  3026.       count = count + 2
  3027.       hold2 = hold2 + CHR(S2I(MID(hold, count, 2), 16))
  3028.       DEC inp_length
  3029.    END WHILE
  3030.  
  3031.    '
  3032.    '  Put the converted number back into 'hold' variable
  3033.    '
  3034.    hold = hold2
  3035.    RETURN
  3036.  
  3037. '
  3038. '  Clear fields in CALLB display by overwriting info with spaces
  3039. '
  3040. :CLEAR_CALLB
  3041.  
  3042.    ANSIPOS 26,9
  3043.    SPRINT SPACE(45)
  3044.    ANSIPOS 26,10
  3045.    SPRINT SPACE(45)
  3046.    ANSIPOS 26,11
  3047.    SPRINT SPACE(45)
  3048.    ANSIPOS 26,12
  3049.    SPRINT SPACE(45)
  3050.    ANSIPOS 26,13
  3051.    SPRINT SPACE(45)
  3052.    ANSIPOS 26,14
  3053.    SPRINT SPACE(45)
  3054.    ANSIPOS 2,18
  3055.    SPRINT SPACE(60)
  3056.    ANSIPOS 2,19
  3057.    SPRINT SPACE(60)
  3058.    ANSIPOS 26,9
  3059.    RETURN
  3060.  
  3061. '
  3062. '  Show how many seconds we have spent on current callback
  3063. '
  3064. :SHOW_TIMEOUT_COUNTDOWN
  3065.  
  3066.    '
  3067.    '  See if enough time has elapsed to update the local callback scren
  3068.    '  with the time spent (in seconds) on the current callback
  3069.    '
  3070.    '  If the time has not changed enough, do not update the screen.
  3071.    '
  3072.    IF (end_time - start_time >= current_timeout_value + 1 || current_timeout_value = 0) THEN
  3073.      IF (current_timeout_value = 0) THEN
  3074.        current_timeout_value = 1
  3075.      ELSE
  3076.        current_timeout_value = end_time - start_time
  3077.      END IF
  3078.      '
  3079.      '  Change color and update the local callback screen with the
  3080.      '  new timeout value for a callback
  3081.      '
  3082.      COLOR @X0F
  3083.      ANSIPOS 66,7
  3084.      SPRINT SPACE(3-LEN(current_timeout_value)), current_timeout_value
  3085.    END IF
  3086.    RETURN
  3087.  
  3088.  
  3089. '
  3090. '  Check for SysOp interrupt - Carriage Return or Space Bar
  3091. '
  3092. '  Carriage Return - Stops the Callback program
  3093. '  Space Bar       - Recycles the Callback program - Starts another call
  3094. '
  3095. :CHECK_SYSOP_KEY
  3096.  
  3097.    hold = KINKEY()
  3098.    IF (hold = 13 || hold = CHR(13)) THEN
  3099.      '
  3100.      '  Flush the keyboard and modem buffers.  Turn on Keyboard checking
  3101.      '  and carrier detect checking as the sysop has decided to abort
  3102.      '  the callback program by hitting ENTER
  3103.      '
  3104.      KBDCHKON
  3105.      KBDFLUSH
  3106.      MDMFLUSH
  3107.      CDCHKON
  3108.      '
  3109.      '  Change colors to write to screen
  3110.      '
  3111.      COLOR @X0F
  3112.      ANSIPOS 3,18
  3113.      SPRINT "**-->>"
  3114.      COLOR @X0C
  3115.      SPRINT " SysOp hit "
  3116.      COLOR @X0F
  3117.      SPRINT "ENTER "
  3118.      COLOR @X0C
  3119.      SPRINT "key to abort callback"
  3120.      ANSIPOS 3,18
  3121.      '
  3122.      '  Log the SysOp hit the ENTER key
  3123.      '
  3124.      FPUTLN 7, "**-->> SysOp hit ENTER key to abort callback"
  3125.      DELAY 36
  3126.      ANSIPOS 1,21
  3127.      '
  3128.      '  Exit the program
  3129.      '
  3130.      GOTO EXIT_PROG
  3131.      '
  3132.    ELSE IF (hold = 32 || hold = CHR(32)) THEN
  3133.      '
  3134.      '  Flush the keyboard and modem buffers
  3135.      '
  3136.      KBDFLUSH
  3137.      MDMFLUSH
  3138.      '
  3139.      '  Change colors to write to screen
  3140.      '
  3141.      COLOR @X0F
  3142.      ANSIPOS 3,18
  3143.      SPRINT "**-->>"
  3144.      COLOR @X0A
  3145.      SPRINT " SysOp hit "
  3146.      COLOR @X0F
  3147.      SPRINT "SPACE BAR "
  3148.      COLOR @X0A
  3149.      SPRINT "to recycle callback"
  3150.      ANSIPOS 3,18
  3151.      '
  3152.      '  Log the SysOp hit the space bar
  3153.      '
  3154.      FPUTLN 7, "**-->> SysOp hit SPACE BAR to recycle callback"
  3155.      sysop_recycle = TRUE
  3156.      COLOR @X0F
  3157.  
  3158.      '
  3159.      '  Update the local callback screen for new call
  3160.      '
  3161.      current_timeout_value = 0
  3162.      GOSUB SHOW_TIMEOUT_COUNTDOWN
  3163.      DELAY 18
  3164.      '
  3165.      '  Clear the callb screen fields display
  3166.      '
  3167.      GOSUB CLEAR_CALLB
  3168.      '
  3169.    END IF
  3170.    RETURN
  3171.  
  3172. '
  3173. '  Check the file BAD_NUM.LST for a matching phone number.  If a match
  3174. '  is found, display the file BADNUM to use and exit the PPE.
  3175. '
  3176. '  NOTE:  The format of BADNUM is one phone number per line.  Comments
  3177. '         are allowed from the 11th character to the end of the line.
  3178. '
  3179. '  Example of entries in BAD_NUM.LST
  3180. '
  3181. '  3019993456 - Number used by banned user
  3182. '  3015552234 - SysOps voice number
  3183. '  301555???? - Block all calls to areacode 301 with exchange 555
  3184. '  *041???????????? - Block all International calls to Country Code 041
  3185. '
  3186. '            Any text from column 26 to the end of the line
  3187. '            can be used for commenting the file.
  3188. '
  3189. '  Wildcards can also be used to help BLOCK certain numbers.  See the
  3190. '  file CB.DOC for proper usage and entry formats
  3191. '
  3192. '
  3193. :CHECK_BAD_NUMBER
  3194.  
  3195.    '
  3196.    '  Initialize variables
  3197.    '
  3198.    found1 = FALSE
  3199.    int_count = 0
  3200.  
  3201.    '
  3202.    '  Open file in read only mode
  3203.    '
  3204.    FOPEN 2, PPEPATH() + "BAD-NUM.LST", O_RD, S_DN
  3205.    FPUTLN 7, "  Checking Number against: BAD-NUM.LST"
  3206.  
  3207.    WHILE (1) DO
  3208.      FGET 2, hold2
  3209.      IF (FERR(2)) BREAK
  3210.  
  3211.      '
  3212.      '  See if the line is a comment
  3213.      '
  3214.      IF (LEFT(hold2,1) = "#" || LEFT(hold2,1) = "'") CONTINUE
  3215.  
  3216.      '
  3217.      '  If US calling plan and we read an International entry,
  3218.      '  read the next line
  3219.      '
  3220.      IF (cp_required = 1 && LEFT(hold2,1) = "*") CONTINUE
  3221.  
  3222.      '
  3223.      '  Retrieve first 25 characters of the line AND TRIM OFF spaces
  3224.      '
  3225.      hold2 = RTRIM(MID(hold2, 1, 25)," ")
  3226.  
  3227.      '
  3228.      '  Check to see if we are using wildcards in the BAD-NUM.LST entry
  3229.      '
  3230.      IF (cp_required = 1) THEN
  3231.  
  3232.        '
  3233.        '  Find position of wildcard character in line.  INSTR will
  3234.        '  report back the first "?" is finds on the line
  3235.        '
  3236.        int_count = INSTR(hold2, "?")
  3237.        SELECT CASE (int_count)
  3238.          CASE 1
  3239.            IF (MID(hold2, 4, 7) = exchange + last_4_nums) found1 = TRUE
  3240.          CASE 4
  3241.            IF (MID(hold2, 1, 3) = area_code && MID(hold2, 7, 4) = last_4_nums) found1 = TRUE
  3242.          CASE 7
  3243.            IF (MID(hold2, 1, 6) = area_code + exchange) found1 = TRUE
  3244.          DEFAULT
  3245.            IF (hold2 = phone_number) found1 = TRUE
  3246.        END SELECT
  3247.      ELSE IF (cp_required = 2) THEN
  3248.        '
  3249.        '  Strip leading "*" from International entry
  3250.        '
  3251.        hold2 = MID(hold2, 2, 24)
  3252.        '
  3253.        '  Find position of wildcard character in line.  INSTR will
  3254.        '  report back the first "?" is finds on the line
  3255.        '
  3256.        int_count = INSTR(hold2, "?")
  3257.        SELECT CASE (int_count)
  3258.          CASE 1
  3259.            IF (RTRIM(MID(hold2, 4, 12)," ") = exchange_code + last_nums) found1 = TRUE
  3260.          CASE 4
  3261.            IF (RTRIM(MID(hold2, 1, 3)," ") = exchange_code && MID(hold2, 8, 8) = last_nums) found1 = TRUE
  3262.          CASE 8
  3263.            IF (RTRIM(MID(hold2, 1, 7)," ") = country_code + exchange_code) found1 = TRUE
  3264.          DEFAULT
  3265.            IF (hold2 = phone_number) found1 = TRUE
  3266.        END SELECT
  3267.      END IF
  3268.  
  3269.      '
  3270.      '  If we match a phone number, display file BADNUM
  3271.      '  and exit out of the program
  3272.      '
  3273.      IF (found1) THEN
  3274.        DISPFILE PPEPATH() + "BADNUM", GRAPH+LANG+SEC
  3275.        FPUTLN 7, "**-->>     Match Found in: BAD-NUM.LST"
  3276.        NEWLINE
  3277.        WAIT
  3278.        GOTO EXIT_PROG
  3279.      END IF
  3280.  
  3281.    END WHILE
  3282.  
  3283.    '
  3284.    '  If we get to here, there was no match found
  3285.    '
  3286.    FPUTLN 7, "        No match found in: BAD-NUM.LST"
  3287.    FCLOSE 2
  3288.    RETURN
  3289.  
  3290. '
  3291. '  Clean up Data and Voice user record phone numbers
  3292. '
  3293. :PREPARE_DATA_VOICE_NUMBERS
  3294.  
  3295.    '
  3296.    '  Clean up Data Phone Number from user record
  3297.    '
  3298.    d_phone_number = U_BDPHONE
  3299.    hold = d_phone_number
  3300.    GOSUB CLEAN_UP_NUMBER
  3301.    d_phone_number = hold
  3302.  
  3303.    '
  3304.    '  Clean up Voice phone number from user record
  3305.    '
  3306.    h_phone_number = U_HVPHONE
  3307.    hold = h_phone_number
  3308.    GOSUB CLEAN_UP_NUMBER
  3309.    h_phone_number = hold
  3310.  
  3311.    RETURN
  3312.  
  3313. '
  3314. '  Subroutine to determine where to post callback information
  3315. '  in user record COMMENT or NOTES
  3316. '
  3317. :POST_COMMENT_NOTES
  3318.  
  3319.    '
  3320.    '  Put phone number into HOLD2 variable depending on calling plan
  3321.    '
  3322.    IF (cp_required = 1) THEN
  3323.      hold2 = area_code + "-" + exchange + "-" + last_4_nums
  3324.    ELSE
  3325.      hold2 = phone_number
  3326.    END IF
  3327.  
  3328.    '
  3329.    '  See which option was chosen for posting
  3330.    '
  3331.    SELECT CASE (post_cbinfo_user_record)
  3332.  
  3333.      '
  3334.      '  Post to COMMENT #1 or COMMENT #2 depending on which field
  3335.      '  has no information in it already
  3336.      '
  3337.      CASE "COMMENT"
  3338.  
  3339.        '
  3340.        '  If COMMENT1 is blank (or all spaces), write info to it
  3341.        '
  3342.        IF (U_CMNT1 = "" || U_CMNT1 = SPACE(LEN(U_CMNT1))) THEN
  3343.          U_CMNT1 = STRING(DATE()) + " " + STRING(TIME()) + " " + hold2
  3344.  
  3345.        '
  3346.        '  If COMMENT2 is blank (or all spaces), write info to it
  3347.        '
  3348.        ELSE IF (U_CMNT2 = "" || U_CMNT2 = SPACE(LEN(U_CMNT2))) THEN
  3349.          U_CMNT2 = STRING(DATE()) + " " + STRING(TIME()) + " " + hold2
  3350.  
  3351.        '
  3352.        '  Both COMMENT fields are used, inform SysOp in LOG file
  3353.        '
  3354.        ELSE
  3355.          FPUTLN 7, "**-->> Both Comment Fields Used - Unable to write info"
  3356.        END IF
  3357.  
  3358.      '
  3359.      '  Post directly to COMMENT #1 irrelevant of the information
  3360.      '  that might be already there.
  3361.      '
  3362.      CASE "COMMENT1"
  3363.          U_CMNT1 = STRING(DATE()) + " " + STRING(TIME()) + " " + hold2
  3364.  
  3365.      '
  3366.      '  Post directly to COMMENT #2 irrelevant of the information
  3367.      '  that might be already there.
  3368.      '
  3369.      CASE "COMMENT2"
  3370.          U_CMNT2 = STRING(DATE()) + " " + STRING(TIME()) + " " + hold2
  3371.  
  3372.      '
  3373.      '  Post to the NOTES field(s) only if the PSA is installed.
  3374.      '  Check each field to make sure we have room to post the
  3375.      '  information.  If all fields are full, then the information
  3376.      '  will not get posted to the NOTES fields
  3377.      '
  3378.      '  The NOTES fields consist of 5 lines consisting of a maximum
  3379.      '  of 60 characters each
  3380.      '
  3381.      CASE "NOTES"
  3382.  
  3383.          '
  3384.          '  Check to see if the NOTES PSA is installed
  3385.          '
  3386.          IF (PSA(6)) THEN
  3387.  
  3388.            '
  3389.            ' User NOTES is made up of 5 lines, with each line having a
  3390.            ' maximum of 60 characters.  If a line is less than 30 chars
  3391.            ' long, add the callback info to the end of the line.  Else,
  3392.            ' find the first blank line to write callback info to
  3393.            '
  3394.            IF (LEN(U_NOTES(0)) < 30 || U_NOTES(0) = SPACE(LEN(U_NOTES(0)))) THEN
  3395.              U_NOTES(0) = TRIM(U_NOTES(0)," ") + STRING(DATE()) + " " + STRING(TIME()) + " " + hold2
  3396.            ELSE IF (LEN(U_NOTES(1)) < 30 || U_NOTES(1) = SPACE(LEN(U_NOTES(1)))) THEN
  3397.              U_NOTES(1) = TRIM(U_NOTES(1)," ") + STRING(DATE()) + " " + STRING(TIME()) + " " + hold2
  3398.            ELSE IF (LEN(U_NOTES(2)) < 30 || U_NOTES(2) = SPACE(LEN(U_NOTES(2)))) THEN
  3399.              U_NOTES(2) = TRIM(U_NOTES(2)," ") + STRING(DATE()) + " " + STRING(TIME()) + " " + hold2
  3400.            ELSE IF (LEN(U_NOTES(3)) < 30 || U_NOTES(3) = SPACE(LEN(U_NOTES(3)))) THEN
  3401.              U_NOTES(3) = TRIM(U_NOTES(3)," ") + STRING(DATE()) + " " + STRING(TIME()) + " " + hold2
  3402.            ELSE IF (LEN(U_NOTES(4)) < 30 || U_NOTES(4) = SPACE(LEN(U_NOTES(4)))) THEN
  3403.              U_NOTES(4) = TRIM(U_NOTES(4)," ") + STRING(DATE()) + " " + STRING(TIME()) + " " + hold2
  3404.            '
  3405.            '  All NOTES fields are used, inform SysOp in LOG file
  3406.            '
  3407.            ELSE
  3408.              FPUTLN 7, "**-->> All NOTES Fields Used - Unable to write info"
  3409.            END IF
  3410.          ELSE
  3411.            FPUTLN 7, "**-->> NOTES PSA is not installed - See PCB Manual for Installation"
  3412.          END IF
  3413.    END SELECT
  3414.    RETURN
  3415.